ported listTableViews and listViews from MDB2 cvs
This commit is contained in:
parent
164138af6c
commit
e68b193c0a
@ -188,7 +188,18 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
|
||||
*/
|
||||
public function listTableViews($table)
|
||||
{
|
||||
$query = "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL";
|
||||
$views = $db->fetchAll($query);
|
||||
|
||||
$result = array();
|
||||
foreach ($views as $row) {
|
||||
if (preg_match("/^create view .* \bfrom\b\s+\b{$table}\b /i", $row['sql'])) {
|
||||
if ( ! empty($row['name'])) {
|
||||
$result[$row['name']] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* lists database users
|
||||
@ -207,7 +218,9 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
|
||||
*/
|
||||
public function listViews($database = null)
|
||||
{
|
||||
$query = "SELECT name FROM sqlite_master WHERE type='view' AND sql NOT NULL";
|
||||
|
||||
return $this->conn->fetchColumn($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user