_table = 'common_card_log'; $this->_pk = 'id'; parent::__construct(); } public function fetch_by_operation($operation) { return DB::fetch_first('SELECT * FROM %t WHERE operation=%d ORDER BY dateline DESC LIMIT 1', array($this->_table, $operation)); } public function fetch_all_by_operation($operation, $start = 0, $limit = 0) { return DB::fetch_all('SELECT * FROM %t WHERE operation=%d ORDER BY dateline DESC '.DB::limit($start, $limit), array($this->_table, $operation)); } public function count_by_operation($operation) { return DB::result_first('SELECT COUNT(*) FROM %t WHERE operation=%d', array($this->_table, $operation)); } } ?>