From 589c35dfdbe01f581364f2d83d0c069f6fee5aa0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 28 Mar 2013 21:00:52 +0100 Subject: [PATCH] Defaulting to memory DB if 'path' not specified Given that we're only using SQLite3 for testing, this is a reasonable default - and it means we don't need to have a special _config.php for CI. --- code/SQLite3Database.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/SQLite3Database.php b/code/SQLite3Database.php index 27dd3ae..623ea69 100644 --- a/code/SQLite3Database.php +++ b/code/SQLite3Database.php @@ -73,13 +73,14 @@ class SQLite3Database extends SS_Database { $dbName = !isset($this->database) ? $parameters['database'] : $dbName=$this->database; //assumes that the path to dbname will always be provided: - $file = $parameters['path'] . '/' . $dbName; + // use the very lightspeed SQLite In-Memory feature for testing - if(isset($parameters['memory']) && $parameters['memory']) { + if((isset($parameters['memory']) && $parameters['memory']) || !isset($parameters['path'])) { $file = ':memory:'; $this->lives_in_memory = true; } else { + $file = $parameters['path'] . '/' . $dbName; $this->lives_in_memory = false; if(!file_exists($parameters['path'])) { SQLiteDatabaseConfigurationHelper::create_db_dir($parameters['path']);