1
0
mirror of synced 2024-12-13 06:46:03 +03:00

[2.0] Fixed hardcoded database name.

This commit is contained in:
romanb 2009-05-30 10:16:54 +00:00
parent 0b09e50148
commit acec85a412
4 changed files with 4 additions and 5 deletions

View File

@ -190,7 +190,7 @@ class MySqlPlatform extends AbstractPlatform
$sql = "SELECT column_name, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM information_schema.key_column_usage WHERE table_name = '" . $table . "'"; $sql = "SELECT column_name, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM information_schema.key_column_usage WHERE table_name = '" . $table . "'";
if ( ! is_null($database)) { if ( ! is_null($database)) {
$sql .= " AND table_schema = 'doctrine_tests'"; $sql .= " AND table_schema = '$database'";
} }
$sql .= " AND REFERENCED_COLUMN_NAME is not NULL"; $sql .= " AND REFERENCED_COLUMN_NAME is not NULL";

View File

@ -221,7 +221,6 @@ abstract class AbstractSchemaManager
$database = $this->_conn->getDatabase(); $database = $this->_conn->getDatabase();
} }
$sql = $this->_platform->getListTableForeignKeysSql($table, $database); $sql = $this->_platform->getListTableForeignKeysSql($table, $database);
$tableForeignKeys = $this->_conn->fetchAll($sql); $tableForeignKeys = $this->_conn->fetchAll($sql);
return $this->_getPortableTableForeignKeysList($tableForeignKeys); return $this->_getPortableTableForeignKeysList($tableForeignKeys);

View File

@ -16,7 +16,7 @@
* *
* This software consists of voluntary contributions made by many individuals * This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\DBAL\Schema; namespace Doctrine\DBAL\Schema;

View File

@ -120,7 +120,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTest
$data['options'] = array('type' => 'innodb'); $data['options'] = array('type' => 'innodb');
$this->createTestTable('list_table_foreign_keys_test1', $data); $this->createTestTable('list_table_foreign_keys_test1', $data);
$this->createTestTable('list_table_foreign_keys_test2', $data); $this->createTestTable('list_table_foreign_keys_test2', $data);
$definition = array( $definition = array(
'name' => 'testing', 'name' => 'testing',
'local' => 'foreign_key_test', 'local' => 'foreign_key_test',
@ -128,7 +128,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTest
'foreignTable' => 'list_table_foreign_keys_test2' 'foreignTable' => 'list_table_foreign_keys_test2'
); );
$this->_sm->createForeignKey('list_table_foreign_keys_test1', $definition); $this->_sm->createForeignKey('list_table_foreign_keys_test1', $definition);
$tableForeignKeys = $this->_sm->listTableForeignKeys('list_table_foreign_keys_test1'); $tableForeignKeys = $this->_sm->listTableForeignKeys('list_table_foreign_keys_test1');
$this->assertEquals(1, count($tableForeignKeys)); $this->assertEquals(1, count($tableForeignKeys));
$this->assertEquals('list_table_foreign_keys_test2', $tableForeignKeys[0]['table']); $this->assertEquals('list_table_foreign_keys_test2', $tableForeignKeys[0]['table']);