Exemplo n.º 1
0
 /**
  * Selects one row from the table based on the given criteria
  *
  * @param B2DBCriteria $crit
  * 
  * @return B2DBRow
  */
 public function doSelectOne(B2DBCriteria $crit, $join = 'all')
 {
     try {
         $crit->setFromTable($this);
         $crit->setupJoinTables($join);
         $crit->setLimit(1);
         $crit->generateSelectSQL();
         $statement = B2DBStatement::getPreparedStatement($crit);
         $resultset = $statement->performQuery();
         $resultset->next();
     } catch (Exception $e) {
         if (B2DB::throwExceptionAsHTML()) {
             B2DB::fatalError($e);
             exit;
         } else {
             throw $e;
         }
     }
     return $resultset->getCurrentRow();
 }