table_myrepeats.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_myrepeats.php 31512 2012-09-04 07:11:08Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_myrepeats extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'myrepeats';
  15. $this->_pk = '';
  16. parent::__construct();
  17. }
  18. public function fetch_all_by_uid($uid) {
  19. return DB::fetch_all("SELECT * FROM %t WHERE uid=%d", array($this->_table, $uid));
  20. }
  21. public function fetch_all_by_username($username) {
  22. return DB::fetch_all("SELECT * FROM %t WHERE username=%s", array($this->_table, $username));
  23. }
  24. public function fetch_all_by_uid_username($uid, $username) {
  25. return DB::fetch_all("SELECT * FROM %t WHERE uid=%d AND username=%s", array($this->_table, $uid, $username));
  26. }
  27. public function count_by_uid_username($uid, $username) {
  28. return DB::result_first("SELECT COUNT(*) FROM %t WHERE uid=%d AND username=%s", array($this->_table, $uid, $username));
  29. }
  30. public function delete_by_uid_usernames($uid, $usernames) {
  31. DB::query("DELETE FROM %t WHERE uid=%d AND username IN (%n)", array($this->_table, $uid, $usernames));
  32. }
  33. public function update_comment_by_uid_username($uid, $username, $value) {
  34. DB::query("UPDATE %t SET comment=%s WHERE uid=%d AND username=%s", array($this->_table, $value, $uid, $username));
  35. }
  36. public function update_locked_by_uid_username($uid, $username, $value) {
  37. DB::query("UPDATE %t SET locked=%d WHERE uid=%d AND username=%s", array($this->_table, $value, $uid, $username));
  38. }
  39. public function update_logindata_by_uid_username($uid, $username, $value) {
  40. DB::query("UPDATE %t SET logindata=%s WHERE uid=%d AND username=%s", array($this->_table, $value, $uid, $username));
  41. }
  42. public function update_lastswitch_by_uid_username($uid, $username, $value) {
  43. DB::query("UPDATE %t SET lastswitch=%d WHERE uid=%d AND username=%s", array($this->_table, $value, $uid, $username));
  44. }
  45. public function count_by_search($condition) {
  46. return DB::result_first("SELECT COUNT(*) FROM %t WHERE 1 %i", array($this->_table, $condition));
  47. }
  48. public function fetch_all_by_search($condition, $start, $ppp) {
  49. return DB::fetch_all("SELECT * FROM %t WHERE 1 %i ORDER BY uid LIMIT %d, %d", array($this->_table, $condition, $start, $ppp));
  50. }
  51. }
  52. ?>