diff options
author | Stanislau Wolski <stanislau.wolski@gmail.com> | 2014-08-08 15:50:58 +0300 |
---|---|---|
committer | Stanislau Wolski <stanislau.wolski@gmail.com> | 2014-08-08 15:50:58 +0300 |
commit | 7e489ef83cf2b3854b71d357e9164ab1f00e310f (patch) | |
tree | 0580fbea288db47ab430f652e399dae01072b46e /codebase/db_pdo.php | |
parent | a3f61f91ca50598de2126ea0864b3acc7f56a847 (diff) | |
download | connector-php-7e489ef83cf2b3854b71d357e9164ab1f00e310f.zip connector-php-7e489ef83cf2b3854b71d357e9164ab1f00e310f.tar.gz connector-php-7e489ef83cf2b3854b71d357e9164ab1f00e310f.tar.bz2 |
[update] updated to dhtmlx 4.x
Diffstat (limited to 'codebase/db_pdo.php')
-rw-r--r-- | codebase/db_pdo.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/codebase/db_pdo.php b/codebase/db_pdo.php index d1ad4d8..1417462 100644 --- a/codebase/db_pdo.php +++ b/codebase/db_pdo.php @@ -39,6 +39,31 @@ class PDODBDataWrapper extends DBDataWrapper{ return $sql; } + public function tables_list() { + $result = $this->query("SHOW TABLES"); + if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); + + $tables = array(); + while ($table = $result->next()) { + $tables[] = $table[0]; + } + return $tables; + } + + public function fields_list($table) { + $result = $this->query("SHOW COLUMNS FROM `".$table."`"); + if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); + + $fields = array(); + $id = ""; + while ($field = $result->next()) { + if ($field['Key'] == "PRI") + $id = $field["Field"]; + else + $fields[] = $field["Field"]; + } + return array("fields" => $fields, "key" => $id ); + } public function get_next($res){ $data = $res->next(); |