Пример #1
0
 public function queryObject($q)
 {
     $_start = $this->_getTime();
     $qTab = explode(' ', Inflector::lower($q));
     $qFirst = $qTab[0];
     $rowAffected = $qFirst == 'insert' || $qFirst == 'update' || $qFirst == 'delete';
     $res = $this->_query($q);
     if (is_array($res)) {
         $count = count($res);
     } else {
         $count = $res->rowCount();
     }
     $this->_incQueries($_start);
     if (true === $rowAffected) {
         return $count;
     }
     if (false === $res) {
         return null;
     }
     if ($count == 0) {
         return null;
     } else {
         $collection = new QueryCollection();
         foreach ($res as $row) {
             $obj = new Row();
             $collection[] = $obj->populate($row);
         }
         return $collection;
     }
 }