Commit 67514f4c authored by lsmith's avatar lsmith

- s/\$db/\$this->conn

- turned raiseError() calls into throw Exception
- MDB2 style query*() conversion to Doctrine style fetch*()
parent 1a21a43e
...@@ -52,7 +52,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import ...@@ -52,7 +52,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import
*/ */
public function listTableFields($table) public function listTableFields($table)
{ {
$table = $db->quote(strtoupper($table), 'text'); $table = $this->conn->quote(strtoupper($table), 'text');
$query = 'SELECT RDB\$FIELD_NAME FROM RDB$RELATION_FIELDS WHERE UPPER(RDB$RELATION_NAME) = ' . $table; $query = 'SELECT RDB\$FIELD_NAME FROM RDB$RELATION_FIELDS WHERE UPPER(RDB$RELATION_NAME) = ' . $table;
return $this->conn->fetchColumn($query); return $this->conn->fetchColumn($query);
...@@ -73,9 +73,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import ...@@ -73,9 +73,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import
*/ */
public function listViews() public function listViews()
{ {
$result = $db->queryCol('SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS'); return $this->conn->fetchColumn('SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS');
return $this->conn->fetchColumn($query);
} }
/** /**
* list the views in the database that reference a given table * list the views in the database that reference a given table
...@@ -86,7 +84,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import ...@@ -86,7 +84,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import
public function listTableViews($table) public function listTableViews($table)
{ {
$query = 'SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS'; $query = 'SELECT DISTINCT RDB$VIEW_NAME FROM RDB$VIEW_RELATIONS';
$table = $db->quote(strtoupper($table), 'text'); $table = $this->conn->quote(strtoupper($table), 'text');
$query .= 'WHERE UPPER(RDB\$RELATION_NAME) = ' . $table; $query .= 'WHERE UPPER(RDB\$RELATION_NAME) = ' . $table;
return $this->conn->fetchColumn($query); return $this->conn->fetchColumn($query);
...@@ -104,7 +102,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import ...@@ -104,7 +102,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import
} }
/** /**
* This function will be called to get all triggers of the * This function will be called to get all triggers of the
* current database ($db->getDatabase()) * current database ($this->conn->getDatabase())
* *
* @param string $table The name of the table from the * @param string $table The name of the table from the
* previous database to query against. * previous database to query against.
...@@ -118,7 +116,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import ...@@ -118,7 +116,7 @@ class Doctrine_Import_Firebird extends Doctrine_Import
OR RDB$SYSTEM_FLAG = 0'; OR RDB$SYSTEM_FLAG = 0';
if ( ! is_null($table)) { if ( ! is_null($table)) {
$table = $db->quote(strtoupper($table), 'text'); $table = $this->conn->quote(strtoupper($table), 'text');
$query .= 'WHERE UPPER(RDB$RELATION_NAME) = ' . $table; $query .= 'WHERE UPPER(RDB$RELATION_NAME) = ' . $table;
} }
......
...@@ -70,18 +70,16 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -70,18 +70,16 @@ class Doctrine_Import_Mssql extends Doctrine_Import
public function listSequences($database = null) public function listSequences($database = null)
{ {
$query = "SELECT name FROM sysobjects WHERE xtype = 'U'"; $query = "SELECT name FROM sysobjects WHERE xtype = 'U'";
$table_names = $db->queryCol($query); $table_names = $this->conn->fetchColumn($query);
if (PEAR::isError($table_names)) {
return $table_names;
}
$result = array(); $result = array();
foreach ($table_names as $table_name) { foreach ($table_names as $table_name) {
if ($sqn = $this->_fixSequenceName($table_name, true)) { if ($sqn = $this->_fixSequenceName($table_name, true)) {
$result[] = $sqn; $result[] = $sqn;
} }
} }
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_map(($db->options['field_case'] == CASE_LOWER ? $result = array_map(($this->conn->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result); 'strtolower' : 'strtoupper'), $result);
} }
return $result; return $result;
...@@ -152,7 +150,7 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -152,7 +150,7 @@ class Doctrine_Import_Mssql extends Doctrine_Import
{ {
$sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name";
return $this->dbh->fetchCol($sql); return $this->dbh->fetchColumn($sql);
} }
/** /**
* lists table triggers * lists table triggers
...@@ -162,21 +160,18 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -162,21 +160,18 @@ class Doctrine_Import_Mssql extends Doctrine_Import
*/ */
public function listTableTriggers($table) public function listTableTriggers($table)
{ {
$table = $db->quote($table, 'text'); $table = $this->conn->quote($table, 'text');
$query = "SELECT name FROM sysobjects WHERE xtype = 'TR'"; $query = "SELECT name FROM sysobjects WHERE xtype = 'TR'";
if (!is_null($table)) { if (!is_null($table)) {
$query .= "AND object_name(parent_obj) = $table"; $query .= "AND object_name(parent_obj) = $table";
} }
$result = $db->queryCol($query); $result = $this->conn->fetchColumn($query);
if (PEAR::isError($results)) {
return $result;
}
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE && if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE &&
$db->options['field_case'] == CASE_LOWER) $this->conn->options['field_case'] == CASE_LOWER)
{ {
$result = array_map(($db->options['field_case'] == CASE_LOWER ? $result = array_map(($this->conn->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result); 'strtolower' : 'strtoupper'), $result);
} }
return $result; return $result;
...@@ -191,8 +186,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -191,8 +186,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import
{ {
$keyName = 'INDEX_NAME'; $keyName = 'INDEX_NAME';
$pkName = 'PK_NAME'; $pkName = 'PK_NAME';
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
if ($db->options['field_case'] == CASE_LOWER) { if ($this->conn->options['field_case'] == CASE_LOWER) {
$keyName = strtolower($keyName); $keyName = strtolower($keyName);
$pkName = strtolower($pkName); $pkName = strtolower($pkName);
} else { } else {
...@@ -200,12 +195,12 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -200,12 +195,12 @@ class Doctrine_Import_Mssql extends Doctrine_Import
$pkName = strtoupper($pkName); $pkName = strtoupper($pkName);
} }
} }
$table = $db->quote($table, 'text'); $table = $this->conn->quote($table, 'text');
$query = 'EXEC sp_statistics @table_name = ' . $table; $query = 'EXEC sp_statistics @table_name = ' . $table;
$indexes = $db->queryCol($query, 'text', $keyName); $indexes = $this->conn->queryCol($query, 'text', $keyName);
$query = 'EXEC sp_pkeys @table_name = ' . $table; $query = 'EXEC sp_pkeys @table_name = ' . $table;
$pkAll = $db->queryCol($query, 'text', $pkName); $pkAll = $this->conn->queryCol($query, 'text', $pkName);
$result = array(); $result = array();
foreach ($indexes as $index) { foreach ($indexes as $index) {
if (!in_array($index, $pkAll) && $index != null) { if (!in_array($index, $pkAll) && $index != null) {
...@@ -213,8 +208,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -213,8 +208,8 @@ class Doctrine_Import_Mssql extends Doctrine_Import
} }
} }
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_change_key_case($result, $db->options['field_case']); $result = array_change_key_case($result, $this->conn->options['field_case']);
} }
return array_keys($result); return array_keys($result);
} }
...@@ -237,12 +232,12 @@ class Doctrine_Import_Mssql extends Doctrine_Import ...@@ -237,12 +232,12 @@ class Doctrine_Import_Mssql extends Doctrine_Import
{ {
$query = "SELECT name FROM sysobjects WHERE xtype = 'V'"; $query = "SELECT name FROM sysobjects WHERE xtype = 'V'";
$result = $db->queryCol($query); $result = $this->conn->fetchColumn($query);
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE && if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE &&
$db->options['field_case'] == CASE_LOWER) $this->conn->options['field_case'] == CASE_LOWER)
{ {
$result = array_map(($db->options['field_case'] == CASE_LOWER ? $result = array_map(($this->conn->options['field_case'] == CASE_LOWER ?
'strtolower' : 'strtoupper'), $result); 'strtolower' : 'strtoupper'), $result);
} }
return $result; return $result;
......
...@@ -91,8 +91,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -91,8 +91,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import
{ {
$key_name = 'Key_name'; $key_name = 'Key_name';
$non_unique = 'Non_unique'; $non_unique = 'Non_unique';
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
if ($db->options['field_case'] == CASE_LOWER) { if ($this->conn->options['field_case'] == CASE_LOWER) {
$key_name = strtolower($key_name); $key_name = strtolower($key_name);
$non_unique = strtolower($non_unique); $non_unique = strtolower($non_unique);
} else { } else {
...@@ -101,9 +101,9 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -101,9 +101,9 @@ class Doctrine_Import_Mysql extends Doctrine_Import
} }
} }
$table = $db->quoteIdentifier($table, true); $table = $this->conn->quoteIdentifier($table, true);
$query = "SHOW INDEX FROM $table"; $query = "SHOW INDEX FROM $table";
$indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC); $indexes = $this->conn->fetchAssoc($query);
$result = array(); $result = array();
foreach ($indexes as $index_data) { foreach ($indexes as $index_data) {
...@@ -119,8 +119,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -119,8 +119,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import
} }
} }
if ($db->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_change_key_case($result, $db->options['field_case']); $result = array_change_key_case($result, $this->conn->options['field_case']);
} }
return array_keys($result); return array_keys($result);
} }
...@@ -163,8 +163,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -163,8 +163,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import
{ {
$key_name = 'Key_name'; $key_name = 'Key_name';
$non_unique = 'Non_unique'; $non_unique = 'Non_unique';
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
if ($db->options['field_case'] == CASE_LOWER) { if ($this->conn->options['field_case'] == CASE_LOWER) {
$key_name = strtolower($key_name); $key_name = strtolower($key_name);
$non_unique = strtolower($non_unique); $non_unique = strtolower($non_unique);
} else { } else {
...@@ -173,9 +173,9 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -173,9 +173,9 @@ class Doctrine_Import_Mysql extends Doctrine_Import
} }
} }
$table = $db->quoteIdentifier($table, true); $table = $this->conn->quoteIdentifier($table, true);
$query = "SHOW INDEX FROM $table"; $query = "SHOW INDEX FROM $table";
$indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC); $indexes = $this->conn->fetchAssoc($query);
$result = array(); $result = array();
...@@ -185,8 +185,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -185,8 +185,8 @@ class Doctrine_Import_Mysql extends Doctrine_Import
} }
} }
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_change_key_case($result, $db->options['field_case']); $result = array_change_key_case($result, $this->conn->options['field_case']);
} }
return array_keys($result); return array_keys($result);
} }
...@@ -230,7 +230,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import ...@@ -230,7 +230,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import
{ {
if (!is_null($database)) { if (!is_null($database)) {
$query = sprintf($this->sql['listViews'], ' FROM ' . $database); $query = sprintf($this->sql['listViews'], ' FROM ' . $database);
} }
return $this->conn->fetchColumn($query); return $this->conn->fetchColumn($query);
} }
......
...@@ -69,7 +69,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -69,7 +69,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
public function listFunctions() public function listFunctions()
{ {
$query = "SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'"; $query = "SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'";
$result = $this->conn->queryCol($query); $result = $this->conn->fetchColumn($query);
if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE
&& $this->conn->options['field_case'] == CASE_LOWER && $this->conn->options['field_case'] == CASE_LOWER
...@@ -97,7 +97,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -97,7 +97,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
public function listSequences($database = null) public function listSequences($database = null)
{ {
$query = "SELECT sequence_name FROM sys.user_sequences"; $query = "SELECT sequence_name FROM sys.user_sequences";
$tableNames = $this->conn->queryCol($query); $tableNames = $this->conn->fetchColumn($query);
$result = array(); $result = array();
foreach ($tableNames as $tableName) { foreach ($tableNames as $tableName) {
...@@ -120,7 +120,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -120,7 +120,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
$table = $this->conn->quote($table, 'text'); $table = $this->conn->quote($table, 'text');
$query = 'SELECT index_name name FROM user_constraints'; $query = 'SELECT index_name name FROM user_constraints';
$query.= ' WHERE table_name='.$table.' OR table_name='.strtoupper($table); $query.= ' WHERE table_name='.$table.' OR table_name='.strtoupper($table);
$constraints = $this->conn->queryCol($query); $constraints = $this->conn->fetchColumn($query);
$result = array(); $result = array();
foreach ($constraints as $constraint) { foreach ($constraints as $constraint) {
...@@ -150,7 +150,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -150,7 +150,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
$result = $this->conn->fetchAssoc($sql); $result = $this->conn->fetchAssoc($sql);
foreach($result as $val) { foreach($result as $val) {
$descr[$val['column_name']] = array( $descr[$val['column_name']] = array(
'name' => $val['column_name'], 'name' => $val['column_name'],
'notnull' => (bool) ($val['nullable'] === 'N'), // nullable is N when mandatory 'notnull' => (bool) ($val['nullable'] === 'N'), // nullable is N when mandatory
'type' => $val['data_type'], 'type' => $val['data_type'],
...@@ -168,12 +168,11 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -168,12 +168,11 @@ class Doctrine_Import_Oracle extends Doctrine_Import
*/ */
public function listTableIndexes($table) public function listTableIndexes($table)
{ {
$table = $this->conn->quote($table, 'text'); $table = $this->conn->quote($table, 'text');
$query = 'SELECT index_name name FROM user_indexes'; $query = 'SELECT index_name name FROM user_indexes';
$query.= ' WHERE table_name='.$table.' OR table_name='.strtoupper($table); $query.= ' WHERE table_name='.$table.' OR table_name='.strtoupper($table);
$query.= ' AND generated=' .$this->conn->quote('N', 'text'); $query.= ' AND generated=' .$this->conn->quote('N', 'text');
$indexes = $this->conn->queryCol($query, 'text'); $indexes = $this->conn->fetchColumn($query);
$result = array(); $result = array();
foreach ($indexes as $index) { foreach ($indexes as $index) {
...@@ -198,9 +197,8 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -198,9 +197,8 @@ class Doctrine_Import_Oracle extends Doctrine_Import
*/ */
public function listTables($database = null) public function listTables($database = null)
{ {
$query = 'SELECT table_name FROM sys.user_tables'; $query = 'SELECT table_name FROM sys.user_tables';
$result = $this->conn->queryCol($query); $result = $this->conn->fetchColumn($query);
if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE
&& $this->conn->options['field_case'] == CASE_LOWER && $this->conn->options['field_case'] == CASE_LOWER
...@@ -236,7 +234,6 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -236,7 +234,6 @@ class Doctrine_Import_Oracle extends Doctrine_Import
*/ */
public function listUsers() public function listUsers()
{ {
if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) { if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) {
$query = 'SELECT SUBSTR(username, '; $query = 'SELECT SUBSTR(username, ';
$query.= (strlen($this->conn->options['database_name_prefix'])+1); $query.= (strlen($this->conn->options['database_name_prefix'])+1);
...@@ -245,7 +242,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -245,7 +242,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
} else { } else {
$query = 'SELECT username FROM sys.dba_users'; $query = 'SELECT username FROM sys.dba_users';
} }
return $this->conn->queryCol($query); return $this->conn->fetchColumn($query);
} }
/** /**
* lists database views * lists database views
...@@ -256,7 +253,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -256,7 +253,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
public function listViews($database = null) public function listViews($database = null)
{ {
$query = 'SELECT view_name FROM sys.user_views'; $query = 'SELECT view_name FROM sys.user_views';
$result = $this->conn->queryCol($query); $result = $this->conn->fetchColumn($query);
if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE
&& $this->conn->options['field_case'] == CASE_LOWER && $this->conn->options['field_case'] == CASE_LOWER
......
...@@ -77,7 +77,7 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader ...@@ -77,7 +77,7 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader
$dbName = 'XXtest'; // @todo FIXME where should we get $dbName = 'XXtest'; // @todo FIXME where should we get
$db->set("name",$dbName); $this->conn->set("name",$dbName);
$tableNames = $dataDict->listTables(); $tableNames = $dataDict->listTables();
foreach ($tableNames as $tableName){ foreach ($tableNames as $tableName){
$table = new Doctrine_Schema_Table(); $table = new Doctrine_Schema_Table();
...@@ -86,7 +86,7 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader ...@@ -86,7 +86,7 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader
foreach ($tableColumns as $tableColumn){ foreach ($tableColumns as $tableColumn){
$table->addColumn($tableColumn); $table->addColumn($tableColumn);
} }
$db->addTable($table); $this->conn->addTable($table);
if ($fks = $dataDict->listTableConstraints($tableName)){ if ($fks = $dataDict->listTableConstraints($tableName)){
foreach ($fks as $fk){ foreach ($fks as $fk){
$relation = new Doctrine_Schema_Relation(); $relation = new Doctrine_Schema_Relation();
......
...@@ -68,18 +68,16 @@ class Doctrine_Import_Sqlite extends Doctrine_Import ...@@ -68,18 +68,16 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
public function listSequences($database = null) public function listSequences($database = null)
{ {
$query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name"; $query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name";
$table_names = $db->queryCol($query); $table_names = $this->conn->fetchColumn($query);
if (PEAR::isError($table_names)) {
return $table_names;
}
$result = array(); $result = array();
foreach ($table_names as $table_name) { foreach ($table_names as $table_name) {
if ($sqn = $this->_fixSequenceName($table_name, true)) { if ($sqn = $this->_fixSequenceName($table_name, true)) {
$result[] = $sqn; $result[] = $sqn;
} }
} }
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result); $result = array_map(($this->conn->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
} }
return $result; return $result;
} }
...@@ -91,18 +89,15 @@ class Doctrine_Import_Sqlite extends Doctrine_Import ...@@ -91,18 +89,15 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
*/ */
public function listTableConstraints($table) public function listTableConstraints($table)
{ {
$table = $db->quote($table, 'text'); $table = $this->conn->quote($table, 'text');
$query = "SELECT sql FROM sqlite_master WHERE type='index' AND "; $query = "SELECT sql FROM sqlite_master WHERE type='index' AND ";
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$query.= 'LOWER(tbl_name)='.strtolower($table); $query.= 'LOWER(tbl_name)='.strtolower($table);
} else { } else {
$query.= "tbl_name=$table"; $query.= "tbl_name=$table";
} }
$query.= " AND sql NOT NULL ORDER BY name"; $query.= " AND sql NOT NULL ORDER BY name";
$indexes = $db->queryCol($query, 'text'); $indexes = $this->conn->fetchColumn($query);
if (PEAR::isError($indexes)) {
return $indexes;
}
$result = array(); $result = array();
foreach ($indexes as $sql) { foreach ($indexes as $sql) {
...@@ -114,8 +109,8 @@ class Doctrine_Import_Sqlite extends Doctrine_Import ...@@ -114,8 +109,8 @@ class Doctrine_Import_Sqlite extends Doctrine_Import
} }
} }
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { if ($this->conn->options['portability'] & Doctrine::PORTABILITY_FIX_CASE) {
$result = array_change_key_case($result, $db->options['field_case']); $result = array_change_key_case($result, $this->conn->options['field_case']);
} }
return array_keys($result); return array_keys($result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment