From acec85a412c369fd3e4ef3470ecc54cd0ebd70c3 Mon Sep 17 00:00:00 2001 From: romanb Date: Sat, 30 May 2009 10:16:54 +0000 Subject: [PATCH] [2.0] Fixed hardcoded database name. --- lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 2 +- lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php | 1 - lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php | 2 +- .../Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index a80070b5b..a75d9e366 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -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 . "'"; if ( ! is_null($database)) { - $sql .= " AND table_schema = 'doctrine_tests'"; + $sql .= " AND table_schema = '$database'"; } $sql .= " AND REFERENCED_COLUMN_NAME is not NULL"; diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index cb3f096ff..366a5ecbe 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -221,7 +221,6 @@ abstract class AbstractSchemaManager $database = $this->_conn->getDatabase(); } $sql = $this->_platform->getListTableForeignKeysSql($table, $database); - $tableForeignKeys = $this->_conn->fetchAll($sql); return $this->_getPortableTableForeignKeysList($tableForeignKeys); diff --git a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php index 0bcd6eca5..3c5770d85 100644 --- a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php @@ -16,7 +16,7 @@ * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see - * . + * . */ namespace Doctrine\DBAL\Schema; diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index 597912e26..ecacc797c 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -120,7 +120,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTest $data['options'] = array('type' => 'innodb'); $this->createTestTable('list_table_foreign_keys_test1', $data); $this->createTestTable('list_table_foreign_keys_test2', $data); - + $definition = array( 'name' => 'testing', 'local' => 'foreign_key_test', @@ -128,7 +128,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTest 'foreignTable' => 'list_table_foreign_keys_test2' ); $this->_sm->createForeignKey('list_table_foreign_keys_test1', $definition); - + $tableForeignKeys = $this->_sm->listTableForeignKeys('list_table_foreign_keys_test1'); $this->assertEquals(1, count($tableForeignKeys)); $this->assertEquals('list_table_foreign_keys_test2', $tableForeignKeys[0]['table']);