public function __construct($table, $connection = null, $structure = null) { $this->db = new DatabaseConnection($connection); $this->table = $table; try { $tcheck = $this->db->getSingleRow("SHOW CREATE TABLE " . $this->table); } catch (Exception $e) { $tcheck = null; } $this->data = array(); if (!$tcheck) { try { $this->db->exec("CREATE TABLE " . $this->table . " (prefskey VARCHAR(64) NOT NULL PRIMARY KEY, data BLOB)"); } catch (Exception $e) { } } $keys = $this->db->getRows("SELECT * FROM " . $this->table); foreach ((array) $keys as $row) { $this->data[$row['prefskey']] = unserialize($row['data']); } parent::__construct($structure); }