示例#1
0
 public static function getRevisionRecords($options = array())
 {
     $options = static::prepareOptions($options, array('indexField' => false, 'conditions' => array(), 'order' => false, 'limit' => false, 'offset' => 0));
     $query = 'SELECT * FROM `%s` WHERE (%s)';
     $params = array(static::$historyTable, count($options['conditions']) ? join(') AND (', static::_mapConditions($options['conditions'])) : 1);
     if ($options['order']) {
         $query .= ' ORDER BY ' . join(',', static::_mapFieldOrder($options['order']));
     }
     if ($options['limit']) {
         $query .= sprintf(' LIMIT %u,%u', $options['offset'], $options['limit']);
     }
     if ($options['indexField']) {
         return DB::table(static::_cn($options['indexField']), $query, $params);
     } else {
         return DB::allRecords($query, $params);
     }
 }
示例#2
0
 public static function getTableByQuery($keyField, $query, $params)
 {
     return static::instantiateRecords(DB::table($keyField, $query, $params, array(static::$rootClass, 'handleError')));
 }