table_forum_forum_threadtable.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_forum_forum_threadtable.php 27819 2012-02-15 05:12:23Z svn_project_zhangjie $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_forum_forum_threadtable extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'forum_forum_threadtable';
  15. $this->_pk = '';
  16. parent::__construct();
  17. }
  18. public function count_by_fid($fids) {
  19. if(empty($fids)) {
  20. return 0;
  21. }
  22. return DB::result_first('SELECT COUNT(*) FROM %t WHERE '.DB::field('fid', $fids), array($this->_table));
  23. }
  24. public function fetch_all_by_fid($fids) {
  25. if(empty($fids)) {
  26. return array();
  27. }
  28. return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('fid', $fids), array($this->_table));
  29. }
  30. public function update($fid, $threadtableid, $data, $unbuffered = false, $low_priority = false) {
  31. if(empty($data)) {
  32. return false;
  33. }
  34. return DB::update($this->_table, $data, array('fid' => $fid, 'threadtableid' => $threadtableid), $unbuffered, $low_priority);
  35. }
  36. public function update_by_threadtableid($threadtableid, $data, $unbuffered = false, $low_priority = false) {
  37. if(empty($data)) {
  38. return false;
  39. }
  40. return DB::update($this->_table, $data, DB::field('threadtableid', $threadtableid), $unbuffered, $low_priority);
  41. }
  42. public function delete($fid, $threadtableid, $unbuffered = false) {
  43. return DB::delete($this->_table, array('fid' => dintval($fid), 'threadtableid' => dintval($threadtableid)), null, $unbuffered);
  44. }
  45. public function delete_none_threads() {
  46. return DB::delete($this->_table, "threads='0'");
  47. }
  48. }
  49. ?>