1
0
mirror of synced 2025-01-29 19:41:45 +03:00

- implemented listTriggers and listTableTriggers()

This commit is contained in:
lsmith 2008-01-10 16:13:56 +00:00
parent 73d63af1f1
commit e0dcd111fe

View File

@ -59,7 +59,7 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
*/
public function listTriggers($database = null)
{
return $this->listTableTriggers(null);
}
/**
@ -190,7 +190,24 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
*/
public function listTableTriggers($table)
{
$query = "SELECT name FROM sqlite_master WHERE type='trigger' AND sql NOT NULL";
if (!is_null($table)) {
if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) {
if ($this->conn->getAttribute(Doctrine::ATTR_FIELD_CASE) == CASE_LOWER) {
$query.= ' AND LOWER(tbl_name)='.$db->quote(strtolower($table), 'text');
} else {
$query.= ' AND UPPER(tbl_name)='.$db->quote(strtoupper($table), 'text');
}
} else {
$query.= ' AND tbl_name='.$db->quote($table, 'text');
}
}
$result = $this->conn->fetchColumn($query);
if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_map(($this->conn->getAttribute(Doctrine::ATTR_FIELD_CASE) == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
}
return $result;
}
/**
@ -237,4 +254,4 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
return $this->conn->fetchColumn($query);
}
}
}