Example #1
0
 private function processModifiers(QC $q)
 {
     $sql = '';
     if ($groupBy = $q->getModifier('groupBy')) {
         $sql .= ' GROUP BY ' . $this->escapeSqlName($groupBy[0]);
     }
     if ($orderBy = $q->getModifier('orderBy')) {
         $sql .= ' ORDER BY ' . $this->escapeSqlName($orderBy[0]);
     }
     if ($q->getModifier('one')) {
         $sql .= ' LIMIT 1';
     } elseif ($limit = $q->getModifier('limit')) {
         if (count($limit) > 1) {
             $limit[0] = implode(', ', $limit);
         }
         $sql .= ' LIMIT ' . $limit[0];
     }
     return $sql;
 }