示例#1
0
 /**
  * Сортировка списка по текущему полю.
  * 
  * @see DataSource_Hybrid_Agent::_fetch_orders()
  * 
  * @param Database_Query $query
  * @param string $dir (ASC|DESC)
  */
 public function sorting_condition(Database_Query $query, $dir)
 {
     $query->order_by($this->name, $dir);
 }
示例#2
0
 /**
  * 
  * @param Database_Query $db
  * @param array $clause
  * @return type
  */
 public static function _conditions($db, array $clause)
 {
     foreach ($clause as $type => $params) {
         switch ($type) {
             case 'select':
                 foreach ($params as $param) {
                     $db->select($param);
                 }
                 break;
             case 'where':
                 foreach ($params as $param) {
                     $db->where($param[0], $param[1], $param[2]);
                 }
                 break;
             case 'or_where':
                 foreach ($params as $param) {
                     $db->or_where($param[0], $param[1], $param[2]);
                 }
                 break;
             case 'order_by':
                 foreach ($params as $param) {
                     $db->order_by($param[0], $param[1]);
                 }
                 break;
             case 'limit':
                 $db->limit((int) $params);
                 break;
             case 'offset':
                 $db->offset((int) $params);
                 break;
         }
     }
     return $db;
 }