diff options
author | Egor <egor.26.93@gmail.com> | 2015-06-11 16:01:20 +0300 |
---|---|---|
committer | Egor <egor.26.93@gmail.com> | 2015-06-11 16:01:20 +0300 |
commit | 5992398183bf84c87dd4315d1532d10022718e9b (patch) | |
tree | c192dec5f76a7875265659d42dc2a5be22fc319b /codebase/DataStorage/MySQLDBDataWrapper.php | |
parent | 388e84730286a153c12a77d9f19215f2b74c5c4f (diff) | |
download | connector-php-5992398183bf84c87dd4315d1532d10022718e9b.zip connector-php-5992398183bf84c87dd4315d1532d10022718e9b.tar.gz connector-php-5992398183bf84c87dd4315d1532d10022718e9b.tar.bz2 |
Changed psr-4 structure to psr-0. Added connectors for phpcake, codeigniter frameworks.
Diffstat (limited to 'codebase/DataStorage/MySQLDBDataWrapper.php')
-rw-r--r-- | codebase/DataStorage/MySQLDBDataWrapper.php | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/codebase/DataStorage/MySQLDBDataWrapper.php b/codebase/DataStorage/MySQLDBDataWrapper.php deleted file mode 100644 index 3f13492..0000000 --- a/codebase/DataStorage/MySQLDBDataWrapper.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -namespace DHTMLX\Connector\DataStorage; - - -/*! Implementation of DataWrapper for MySQL -**/ -class MySQLDBDataWrapper extends DBDataWrapper{ - protected $last_result; - public function query($sql){ - LogMaster::log($sql); - $res=mysql_query($sql,$this->connection); - if ($res===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); - $this->last_result = $res; - return $res; - } - - public function get_next($res){ - if (!$res) - $res = $this->last_result; - - return mysql_fetch_assoc($res); - } - - public function get_new_id(){ - return mysql_insert_id($this->connection); - } - - public function escape($data){ - return mysql_real_escape_string($data, $this->connection); - } - - public function tables_list() { - $result = mysql_query("SHOW TABLES"); - if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); - - $tables = array(); - while ($table = mysql_fetch_array($result)) { - $tables[] = $table[0]; - } - return $tables; - } - - public function fields_list($table) { - $result = mysql_query("SHOW COLUMNS FROM `".$table."`"); - if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); - - $fields = array(); - $id = ""; - while ($field = mysql_fetch_assoc($result)) { - if ($field['Key'] == "PRI") - $id = $field["Field"]; - else - $fields[] = $field["Field"]; - } - return array("fields" => $fields, "key" => $id ); - } - - /*! escape field name to prevent sql reserved words conflict - @param data - unescaped data - @return - escaped data - */ - public function escape_name($data){ - if ((strpos($data,"`")!==false || is_int($data)) || (strpos($data,".")!==false)) - return $data; - return '`'.$data.'`'; - } -}
\ No newline at end of file |