From 98df3e331f8f1e3b5928bfb1518fd222a8438c3a Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 23 Feb 2011 11:36:41 -0500 Subject: [PATCH] Fixing DboMysql not quoting database names in listSources. Updated tests. Fixes #1552 --- cake/libs/model/datasources/dbo/dbo_mysql.php | 2 +- .../cases/libs/model/datasources/dbo/dbo_mysql.test.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 19d030b83..3b00a49a6 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -182,7 +182,7 @@ class DboMysql extends DboSource { if ($cache != null) { return $cache; } - $result = $this->_execute('SHOW TABLES FROM ' . $this->config['database']); + $result = $this->_execute('SHOW TABLES FROM ' . $this->name($this->config['database'])); if (!$result) { $result->closeCursor(); diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index f9f05dc6b..b31f4e5d6 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -779,7 +779,7 @@ class DboMysqlTest extends CakeTestCase { $queryResult = $this->getMock('PDOStatement'); $db->expects($this->once()) ->method('_execute') - ->with('SHOW TABLES FROM cake') + ->with('SHOW TABLES FROM `cake`') ->will($this->returnValue($queryResult)); $queryResult->expects($this->at(0)) ->method('fetch') @@ -2869,7 +2869,7 @@ class DboMysqlTest extends CakeTestCase { * @return void */ function testVirtualFields() { - $this->loadFixtures('Article', 'Comment'); + $this->loadFixtures('Article', 'Comment', 'Tag'); $this->Dbo->virtualFieldSeparator = '__'; $Article = ClassRegistry::init('Article'); $Article->virtualFields = array( @@ -2939,7 +2939,7 @@ class DboMysqlTest extends CakeTestCase { * @return void */ function testVirtualFieldsInConditions() { - $Article = ClassRegistry::init('Article'); + $Article = ClassRegistry::init('Article', 'Comment', 'Tag'); $Article->virtualFields = array( 'this_moment' => 'NOW()', 'two' => '1 + 1', @@ -2973,7 +2973,7 @@ class DboMysqlTest extends CakeTestCase { * @return void */ function testConditionsWithComplexVirtualFields() { - $Article = ClassRegistry::init('Article'); + $Article = ClassRegistry::init('Article', 'Comment', 'Tag'); $Article->virtualFields = array( 'distance' => 'ACOS(SIN(20 * PI() / 180) * SIN(Article.latitude * PI() / 180)