if ($this->type == 'sqlite') {
$sql = "SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name";
+
} elseif ($this->type == 'pgsql') {
$sql = "SELECT table_name FROM information_schema.tables WHERE table_type in('BASE TABLE','LOCAL TEMPORARY') AND table_schema NOT IN ('pg_catalog', 'information_schema')";
+
+ } elseif ($this->type == 'mysql') {
+ $sql = "SHOW TABLES";
+
} else {
err('db.tables(): Unknow db type: '.$this->type);
return array();
} elseif ($this->db->type == 'pgsql') {
$sql = "SELECT a.attname as name, pg_catalog.format_type(a.atttypid, a.atttypmod) as type, case a.attnotnull when 't' then 1 else 0 end as notnull FROM pg_catalog.pg_attribute a WHERE a.attrelid = (SELECT c.oid FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname='$this->name' AND pg_catalog.pg_table_is_visible(c.oid) ) AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum";
+ } elseif ($this->db->type == 'mysql') {
+ $sql = "SHOW COLUMNS FROM `$this->name`";
+
} else {
err('table.fields(): Unknow db type: '.$this->db->type);
return array();