_table = 'common_block_favorite'; $this->_pk = 'favid'; parent::__construct(); } public function delete_by_uid_bid($uid, $bid) { return ($uid = dintval($uid)) && ($bid = dintval($bid)) ? DB::delete($this->_table, DB::field('uid', $uid).' AND '.DB::field('bid', $bid)) : false; } public function delete_by_bid($bid) { return ($bid = dintval($bid)) ? DB::delete($this->_table, DB::field('bid', $bid)) : false; } public function count_by_uid_bid($uid, $bid){ return ($uid = dintval($uid)) && ($bid = dintval($bid)) ? DB::result_first('SELECT count(*) FROM %t WHERE uid=%d AND bid=%d', array($this->_table, $uid, $bid)) : false; } public function fetch_all_by_uid($uid) { return ($uid = dintval($uid)) ? DB::fetch_all('SELECT * FROM %t WHERE uid=%d ORDER BY dateline DESC', array($this->_table, $uid), 'bid') : array(); } } ?>