/** * Check if a table exists in the (sqlite) database. * * @param string $table * @return bool */ private function tableExists($table) { static $tables = array(); if (isset($tables[$table]) === false) { $tables[$table] = (bool) self::$database->fetchValue('SELECT count(*) FROM sqlite_master WHERE type="table" AND name=' . self::$database->quote($table)); } return $tables[$table]; }