2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 * DAO for "config" table
20 if (!defined('TR_INCLUDE_PATH')) exit;
22 require_once(TR_INCLUDE_PATH. 'classes/DAO/DAO.class.php');
24 class ConfigDAO extends DAO {
27 * Insert a new config row
33 function Create($name, $value)
35 $sql = "INSERT INTO ".TABLE_PREFIX."config (name, value)
36 VALUES ('".$name."', '".$value."')";
37 return $this->execute($sql);
44 * @return true or false
47 function Replace($name, $value)
49 $sql = "REPLACE INTO ".TABLE_PREFIX."config
50 VALUES ('".$name."', '".$value."')";
51 return $this->execute($sql);
58 * @return true or false
61 function Delete($name)
63 $sql = "DELETE FROM ".TABLE_PREFIX."config
64 WHERE name = '".$name."'";
65 return $this->execute($sql);
69 * Return all config' information
77 $sql = 'SELECT * FROM '.TABLE_PREFIX.'config ORDER BY name';
78 return $this->execute($sql);
82 * Return a config row by name
90 $sql = "SELECT * FROM ".TABLE_PREFIX."config WHERE name = '".$name."'";
91 $rows = $this->execute($sql);