diff options
author | Stanislau Wolski <stanislau.wolski@gmail.com> | 2013-10-18 14:02:16 +0300 |
---|---|---|
committer | Stanislau Wolski <stanislau.wolski@gmail.com> | 2013-10-18 14:02:16 +0300 |
commit | c2e1fd58b0c848118cf8554de50f788199d609e2 (patch) | |
tree | bd30b3b7de59b34120705465e8628a740cdb513d /codebase/connector/db_mysqli.php | |
download | scheduler-c2e1fd58b0c848118cf8554de50f788199d609e2.zip scheduler-c2e1fd58b0c848118cf8554de50f788199d609e2.tar.gz scheduler-c2e1fd58b0c848118cf8554de50f788199d609e2.tar.bz2 |
[add] version 4.0v4.0.0
Diffstat (limited to 'codebase/connector/db_mysqli.php')
-rw-r--r-- | codebase/connector/db_mysqli.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/codebase/connector/db_mysqli.php b/codebase/connector/db_mysqli.php new file mode 100644 index 0000000..6740a3b --- /dev/null +++ b/codebase/connector/db_mysqli.php @@ -0,0 +1,56 @@ +<?php +/* + @author dhtmlx.com + @license GPL, see license.txt +*/ +require_once("db_common.php"); + +class MySQLiDBDataWrapper extends MySQLDBDataWrapper{ + + public function query($sql){ + LogMaster::log($sql); + $res = $this->connection->query($sql); + if ($res===false) throw new Exception("MySQL operation failed\n".$this->connection->error); + return $res; + } + + public function get_next($res){ + return $res->fetch_assoc(); + } + + public function get_new_id(){ + return $this->connection->insert_id; + } + + public function escape($data){ + return $this->connection->real_escape_string($data); + } + + public function tables_list() { + $result = $this->connection->query("SHOW TABLES"); + if ($result===false) throw new Exception("MySQL operation failed\n".$this->connection->error); + + $tables = array(); + while ($table = $result->fetch_array()) { + $tables[] = $table[0]; + } + return $tables; + } + + public function fields_list($table) { + $result = $this->connection->query("SHOW COLUMNS FROM `".$table."`"); + if ($result===false) throw new Exception("MySQL operation failed\n".$this->connection->error); + $fields = array(); + while ($field = $result->fetch_array()) { + if ($field['Key'] == "PRI") { + $fields[$field[0]] = 1; + } else { + $fields[$field[0]] = 0; + } + } + return $fields; + } + +} + +?>
\ No newline at end of file |