Advertisement
Guest User

Generic Loop - Model

a guest
Mar 26th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2. class Sedo_Chinese_Model_Temp extends XenForo_Model
  3. {
  4.     public function createTempDb()
  5.     {
  6.         return $this->_getDb()->query("CREATE TABLE IF NOT EXISTS sedo_temp (
  7.                 id INT NOT NULL AUTO_INCREMENT,
  8.                 name tinytext NOT NULL,
  9.                 loops INT NOT NULL,
  10.                 temp longtext NOT NULL,
  11.                 redirect tinytext NOT NULL,
  12.                 phrase tinytext NOT NULL,
  13.                 extras mediumtext NOT NULL,            
  14.                 PRIMARY KEY (id)
  15.             )
  16.             ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;"
  17.         );
  18.     }
  19.  
  20.     public function deleteTempDb()
  21.     {
  22.         XenForo_Application::setSimpleCacheData('sedo_chinese_loop', false);
  23.         return $this->_getDb()->query("DROP TABLE IF EXISTS sedo_temp");   
  24.     }
  25.  
  26.     public function getDatasByName($name)
  27.     {
  28.         return $this->_getDb()->fetchRow('
  29.             SELECT *
  30.             FROM sedo_temp
  31.             WHERE name = ?
  32.         ', $name);
  33.     }
  34.  
  35.     public function getDatasById($id)
  36.     {
  37.         return $this->_getDb()->fetchRow('
  38.             SELECT *
  39.             FROM sedo_temp
  40.             WHERE id = ?
  41.         ', $id);
  42.     }  
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement