ported listTableViews and listViews from MDB2 cvs
This commit is contained in:
parent
164138af6c
commit
e68b193c0a
@ -139,7 +139,7 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
|
|||||||
'length' => null,
|
'length' => null,
|
||||||
'scale' => null,
|
'scale' => null,
|
||||||
'precision' => null,
|
'precision' => null,
|
||||||
'unsigned' => null,
|
'unsigned' => null,
|
||||||
);
|
);
|
||||||
$columns[$val['name']] = $description;
|
$columns[$val['name']] = $description;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,18 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
|
|||||||
*/
|
*/
|
||||||
public function listTableViews($table)
|
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
|
* lists database users
|
||||||
@ -207,7 +218,9 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
|
|||||||
*/
|
*/
|
||||||
public function listViews($database = null)
|
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