From 020fcbea26bfdfcb25b6505e93e5d3051362dd58 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 12 Jun 2014 14:44:55 +1200 Subject: [PATCH] Fixing hardcoded queries that are MySQL specific. --- code/TestSessionEnvironment.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/TestSessionEnvironment.php b/code/TestSessionEnvironment.php index 348f917..1aa44f7 100644 --- a/code/TestSessionEnvironment.php +++ b/code/TestSessionEnvironment.php @@ -185,7 +185,7 @@ class TestSessionEnvironment extends Object { DB::connect($databaseConfig); } else { // We've already connected to the database, do a fast check to see what database we're currently using - $db = DB::query("SELECT DATABASE()")->value(); + $db = DB::getConn()->currentDatabase(); if(isset($state->database) && $db != $state->database) { $this->oldDatabaseName = $databaseConfig['database']; $databaseConfig['database'] = $state->database; @@ -199,9 +199,7 @@ class TestSessionEnvironment extends Object { $dbName = (isset($state->database)) ? $state->database : null; if($dbName) { - $dbExists = (bool)DB::query( - sprintf("SHOW DATABASES LIKE '%s'", Convert::raw2sql($dbName)) - )->value(); + $dbExists = DB::getConn()->databaseExists($dbName); } else { $dbExists = false; } @@ -410,4 +408,4 @@ class TestSessionEnvironment extends Object { $path = Director::getAbsFile($this->getFilePath()); return (file_exists($path)) ? json_decode(file_get_contents($path)) : new stdClass; } -} \ No newline at end of file +}