Exemple #1
0
 /**
  *  just some common stuff that needs to be assured before queries can work
  *  
  *  @since  4-29-11
  *  @param  MingoTable  $table
  *  @return boolean
  */
 protected function assure(MingoTable $table = null)
 {
     // make sure table is valid...
     if ($table !== null) {
         if (!$table->hasName()) {
             throw new UnexpectedValueException('no $table specified');
         }
         //if
     }
     //if
     // make sure connection is valid...
     if (!$this->isConnected()) {
         if (!$this->connect()) {
             throw new UnexpectedValueException('no db connection found');
         }
         //if
     }
     //if
     return true;
 }