foreach ($this->conn->query($sql,PDO::FETCH_ASSOC) as $row) {
#debug($row);
$name = current($row);
- $this->table($name,$row);
+ $t = $this->table($name,$row);
}
}
# NB 03.09.16
# Handle attach mechnisum
#$Db->tables();
+ static $sql;
+ if (isset($sql)) return $sql;
$dbs = $Db->databases();
$debug = 0;#$Db->p('db')=='all';
+ $sql = "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'";
if (count($dbs)<2) {
- return "SELECT name,type FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'";
+ return $sql;
}
if ($debug) debug($dbs);
$sql = '';
foreach ($dbs as $db) {
$sql .= ($sql ? ' UNION ' : '').str_replace('sqlite_',$db['name'].'.sqlite_',
- #"SELECT name as name,type FROM sqlite_master WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'"
- "SELECT '".$db['name'].".'||name as name,type FROM sqlite_master WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'"
+ #"SELECT '".$db['name'].".'||name as name,type FROM sqlite_master WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'"
+ "SELECT name,type FROM sqlite_master WHERE type IN('table','view') AND name NOT LIKE 'sqlite_%'"
);
}
if ($debug) debug($sql);