database = $options['database']; $this->table = $options['table']; } public static function create($options) { return new self($options); } public function preload() { return $this->database->selectAssoc("SELECT name,type,value FROM {$this->table}", 'name', array('name', 'value', 'type')); } public function save() { throw new Sihnon_Exception_NotImplemented(); } public function set($key, $value) { return $this->database->update("UPDATE `{$this->table}` SET `value`=:value WHERE `name`=:name", array( array('name' => 'name', 'value' => $key, 'type' => PDO::PARAM_STR), array('name' => 'value', 'value' => $value, 'type' => PDO::PARAM_STR), )); } public function add($key, $type, $value) { return $this->database->insert("INSERT INTO `{$this->table}` (`name`,`value`,`type`) VALUES(:name,:value,:type)", array( array('name' => 'name', 'value' => $key, 'type' => PDO::PARAM_STR), array('name' => 'value', 'value' => $value, 'type' => PDO::PARAM_STR), array('name' => 'type', 'value' => $type, 'type' => PDO::PARAM_STR), )); } } ?>