4 * class for storing changes when shard is offline.
5 * @todo make sure that the querycache class is being used by the sync class and also for inserting the queries themselfs into it.
6 * Atm this class isn't used yet if I remember correctly
7 * @author Daan Janssens, mentored by Matthew Lagoe
12 private $SID; /**< The queries ID */
13 private $type; /**< The type of query*/
14 private $query; /**< The query itself (json encoded) */
15 private $db; /**< the db where the query should be performed */
17 ////////////////////////////////////////////Functions////////////////////////////////////////////////////
21 ////////////////////////////////////////////Methods////////////////////////////////////////////////////
28 public function __construct() {
32 * sets the object's attributes.
33 * @param $values should be an array of the form array('SID' => sid, 'type' => type, 'query' => query, 'db' => db).
35 public function set($values) {
36 $this->setSID($values['SID']);
37 $this->setType($values['type']);
38 $this->setQuery($values['query']);
39 $this->setDb($values['db']);
44 * loads the object's attributes.
45 * loads the object's attributes by giving a SID as parameter
46 * @param $id the id of the querycaches row
48 public function load_With_SID( $id) {
49 $dbl = new DBLayer("lib");
50 $statement = $dbl->select("ams_querycache", array('id' => $id), "SID=:id");
51 $row = $statement->fetch();
59 public function update(){
60 $dbl = new DBLayer("lib");
61 $dbl->update("ams_querycache", Array('type' => $this->getType(), 'query' => $this->getQuery(), 'db' => $this->getDb(), "SID=$this->getSID()" ));
64 ////////////////////////////////////////////Getters////////////////////////////////////////////////////
67 * get SID attribute of the object.
69 public function getSID(){
74 * get type attribute of the object.
76 public function getType(){
81 * get query attribute of the object.
83 public function getQuery(){
88 * get db attribute of the object.
90 public function getDb(){
94 ////////////////////////////////////////////Setters////////////////////////////////////////////////////
97 * set SID attribute of the object.
98 * @param $s integer id
100 public function setSID($s){
105 * set type attribute of the object.
106 * @param $t type of the query, could be changePassword, changePermissions, changeEmail, createUser
108 public function setType($t){
113 * set query attribute of the object.
114 * @param $q query string
116 public function setQuery($q){
121 * set db attribute of the object.
122 * @param $d the name of the database in the config global var that we want to use.
124 public function setDb($d){