X-Git-Url: http://git.dj3c1t.com/index.cgi?p=mtweb;a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fimpl%2Fmw_pdo_sqlite.php;fp=mw%2Fapp%2Fdata%2Fimpl%2Fmw_pdo_sqlite.php;h=918bc8af1a9fe0d08ad720d88453d6ffaee91e42;hp=8fd7debfc8ea7f891912687e8d8655f8c8307282;hb=8da84cf3aa4d10d91f19b6df06ce4c5e9fcb79da;hpb=5abc9d5fca28ef86dee6148bb96780d1a7b670f3 diff --git a/mw/app/data/impl/mw_pdo_sqlite.php b/mw/app/data/impl/mw_pdo_sqlite.php index 8fd7deb..918bc8a 100644 --- a/mw/app/data/impl/mw_pdo_sqlite.php +++ b/mw/app/data/impl/mw_pdo_sqlite.php @@ -1,38 +1,28 @@ host = isset($params["host"]) ? $params["host"] : "content/data/sqlite"; - $this->base = isset($params["base"]) ? $params["base"] : "mtweb.db"; - $this->user = isset($params["user"]) ? $params["user"] : ""; - $this->password = isset($params["password"]) ? $params["password"] : ""; - $this->EXTENTION_OK = (extension_loaded("pdo") && extension_loaded("pdo_sqlite")); + class mw_pdo_sqlite extends mw_sgbd{ + + public function name(){ + return "PDO SQLite"; } - public function get_link(){ - return $this->link; + public function default_params(){ + return array( + "host" => "content/data/sqlite", + "base" => "mtweb.db", + "user" => "", + "password" => "" + ); } - public function extention_ok(&$env){ - return $this->EXTENTION_OK; + public function validate_extention(){ + return extension_loaded("pdo") && extension_loaded("pdo_sqlite"); } public function authentication_required(){ return false; } - public function sgbd_name(){ - return "PDO SQLite"; - } - public function connect($host, $base, $user, $password){ if($host) $host .= substr($host, -1) != "/" ? "/" : ""; try{ @@ -53,6 +43,7 @@ } public function desc_table($table_name){ + $table_name = $this->replace_prefixes($table_name); if(strpos($table_name, "'") !== false){ throw new Exception($this->exception_out("nom de table avec un simple quote")); } @@ -78,6 +69,7 @@ } public function table_exists($table_name){ + $table_name = $this->replace_prefixes($table_name); if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); $EXISTS = false; try{ @@ -97,6 +89,7 @@ } public function field_exists($table_name, $field_name){ + $table_name = $this->replace_prefixes($table_name); if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); if(!($desc = $this->desc_table($table_name))){ throw new Exception($this->exception_out("Impossible de lire la description de la table")); @@ -111,7 +104,8 @@ return $EXISTS; } - public function query($query_string){ + public function query($query_string){ + $query_string = $this->replace_prefixes($query_string); if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); if(!($result = $this->link->query($query_string))){ throw new Exception($this->exception_out("Syntaxe invalide dans une requete"));