X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=web%2Fapp%2Fdata%2Fimpl%2Fmw_mysql.php;fp=web%2Fapp%2Fdata%2Fimpl%2Fmw_mysql.php;h=0000000000000000000000000000000000000000;hb=36ed114046cbe3d72a3589230e9f306a54fcc79d;hp=0cff0c20bf5cccd3d1c6bc4fc0bae891be7c4115;hpb=281c96e95451269f2614684b8de5be25862c8374;p=mtweb diff --git a/web/app/data/impl/mw_mysql.php b/web/app/data/impl/mw_mysql.php deleted file mode 100644 index 0cff0c2..0000000 --- a/web/app/data/impl/mw_mysql.php +++ /dev/null @@ -1,96 +0,0 @@ -EXTENTION_OK; } - - function mw_mysql($host, $base, $user, $password){ - $this->host = $host; - $this->base = $base; - $this->user = $user; - $this->password = $password; - $this->EXTENTION_OK = function_exists("mysql_connect"); - } - - function connect($host, $base, $user, $password){ - $this->link = @mysql_connect($host, $user, $password); - if(!$this->link) throw new Exception($this->exception_out("Impossible d'etablir une connection au serveur")); - @mysql_query("SET NAMES 'utf8'"); - if($base){ - $connected = @mysql_select_db($base, $this->link); - if(!$connected) throw new Exception($this->exception_out("Impossible de selectioner la base ".$base)); - } - return true; - } - - function select_db($db_name){ - $this->base = $db_name; - if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); - return $this->query("USE ".$db_name); - } - - function table_exists($table){ - if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); - $rst = $this->query("SHOW TABLES"); - while($v_rst = mysql_fetch_array($rst)){ - if(strcmp($v_rst[0], $table) == 0) return true; - } - mysql_free_result($rst); - return false; - } - - function query($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")); - return $result; - } - - function fetch_assoc($rst){ - if($this->link){ - if($rst){ - return mysql_fetch_assoc($rst); - } - else throw new Exception($this->exception_out("fetch_assoc sans result handler")); - } - else throw new Exception($this->exception_out("fetch_assoc sans connexion")); - } - - function insert_id(){ - if($this->link){ - return mysql_insert_id($this->link); - } - else throw new Exception($this->exception_out("insert_id sans connexion")); - } - - function free_result($rst){ - if($this->link){ - if($rst){ - return mysql_free_result($rst); - } - else throw new Exception($this->exception_out("free_result sans result handler")); - } - else throw new Exception($this->exception_out("free_result sans connexion")); - } - - function close(){ - if($this->link) return mysql_close($this->link); - return true; - } - - function exception_out($message){ - return "[erreur] mysql : ".$message; - } - - } - -?> \ No newline at end of file