summaryrefslogtreecommitdiffstats
path: root/codebase/db_pdo.php
diff options
context:
space:
mode:
authorStanislau Wolski <stanislau.wolski@gmail.com>2014-11-03 20:13:33 +0300
committerStanislau Wolski <stanislau.wolski@gmail.com>2014-11-03 20:13:33 +0300
commitb4f88ab0656d98e41d446f6f3fa7ff5ee941a48d (patch)
treeb747c23c354d7e18ab21d72698d2124d778e2b3a /codebase/db_pdo.php
parentc1a155bd754eb89137a45056e2ef9b1d13b2501c (diff)
parentaafef026fb6b024ae25ebc79680840049ca718a5 (diff)
downloadconnector-php-b4f88ab0656d98e41d446f6f3fa7ff5ee941a48d.zip
connector-php-b4f88ab0656d98e41d446f6f3fa7ff5ee941a48d.tar.gz
connector-php-b4f88ab0656d98e41d446f6f3fa7ff5ee941a48d.tar.bz2
Merge branch 'pdo'
Diffstat (limited to 'codebase/db_pdo.php')
-rw-r--r--codebase/db_pdo.php25
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();