Esempio n. 1
0
 public function sort($object)
 {
     $object = Helper::jsonDecode($object, true);
     $this->_sortKey = Helper::firstKey($object);
     $this->_sortVal = $object[$this->_sortKey];
     uasort($this->rows, array('\\rollingWolf\\QueryablePHP\\DB\\Result', 'cmp'));
     return $this;
 }
Esempio n. 2
0
 private function _doQuery()
 {
     $result = $this->master->getRows();
     $clauses = @Helper::jsonDecode(func_get_arg(0));
     if (is_array($clauses) && Helper::firstKey($clauses) === null) {
         return $result;
     }
     foreach ($clauses as $key => $clause) {
         $clausetype = $this->_detectClauseType($key, $clause);
         switch ($clausetype) {
             case self::CLAUSE_NORMAL:
                 $result = $this->_matchingRowsNormal('{"key": "' . $key . '", "value": "' . $clause . '"}', $result);
                 break;
             case self::CLAUSE_CONDITIONAL:
                 $result = $this->_matchingRowsConditional('{"key": "' . $key . '", "value": ' . json_encode($clause) . '}', $result);
                 break;
             case self::CLAUSE_OR:
                 $result = $this->_matchingRowsOr($clause, $result);
                 break;
             case self::CLAUSE_AND:
                 foreach ($clause as $subclause) {
                     $result = $this->_matchingRowsAnd($subclause, $result);
                 }
             default:
                 break;
         }
     }
     return $result;
 }