X-Git-Url: http://git.dj3c1t.com/index.cgi?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fimpl%2Fmw_mysql.php;h=5128c04919acd620eba23e9c48321bd481bca519;hb=8da84cf3aa4d10d91f19b6df06ce4c5e9fcb79da;hp=8a5838473e449130bfc58f39e4513775bc8c13b0;hpb=5abc9d5fca28ef86dee6148bb96780d1a7b670f3;p=mtweb diff --git a/mw/app/data/impl/mw_mysql.php b/mw/app/data/impl/mw_mysql.php index 8a58384..5128c04 100644 --- a/mw/app/data/impl/mw_mysql.php +++ b/mw/app/data/impl/mw_mysql.php @@ -1,32 +1,26 @@ host = isset($params["host"]) ? $params["host"] : "localhost"; - $this->base = isset($params["base"]) ? $params["base"] : "mtweb"; - $this->user = isset($params["user"]) ? $params["user"] : ""; - $this->password = isset($params["password"]) ? $params["password"] : ""; - $this->EXTENTION_OK = function_exists("mysql_connect"); + class mw_mysql extends mw_sgbd{ + + public function name(){ + return "MySql"; } - public function extention_ok(&$env){ - return $this->EXTENTION_OK; + public function default_params(){ + return array( + "host" => "localhost", + "base" => "mtweb", + "user" => "", + "password" => "" + ); } - public function authentication_required(){ - return true; + public function validate_extention(){ + return function_exists("mysql_connect"); } - public function sgbd_name(){ - return "MySql"; + public function authentication_required(){ + return true; } public function connect($host, $base, $user, $password){ @@ -47,6 +41,7 @@ } public function desc_table($table_name){ + $table_name = $this->replace_prefixes($table_name); $sql = "SELECT * from information_schema.columns where table_name='".$table_name."'"; $rst = $this->query($sql); $desc = array( @@ -69,7 +64,8 @@ return $desc; } - public function table_exists($table_name){ + 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{ @@ -89,6 +85,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")); @@ -103,7 +100,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); $result = @mysql_query($query_string, $this->link); if(!$result) throw new Exception($this->exception_out("Syntaxe invalide dans une requete"));