1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/sqlite3] Add support for SQLite 3

Minimum version requirement is 3.6.15 as that's what ships with PHP 5.3.0
when support for SQLite 3 was added.

PHPBB3-9728
This commit is contained in:
Patrick Webster
2013-11-03 21:58:05 -06:00
committed by Joas Schilling
parent d52c2d1b5c
commit b39b0369aa
23 changed files with 699 additions and 64 deletions

View File

@@ -53,6 +53,7 @@ class phpbb_database_test_connection_manager
switch ($this->dbms['PDO'])
{
case 'sqlite2':
case 'sqlite': // SQLite3 driver
$dsn .= $this->config['dbhost'];
break;
@@ -191,6 +192,7 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
case 'phpbb\db\driver\sqlite':
case 'phpbb\db\driver\sqlite3':
case 'phpbb\db\driver\firebird':
$this->connect();
// Drop all of the tables
@@ -272,6 +274,13 @@ class phpbb_database_test_connection_manager
WHERE type = "table"';
break;
case 'phpbb\db\driver\sqlite3':
$sql = 'SELECT name
FROM sqlite_master
WHERE type = "table"
AND name <> "sqlite_sequence"';
break;
case 'phpbb\db\driver\mssql':
case 'phpbb\db\driver\mssql_odbc':
case 'phpbb\db\driver\mssqlnative':
@@ -436,6 +445,11 @@ class phpbb_database_test_connection_manager
'DELIM' => ';',
'PDO' => 'sqlite2',
),
'phpbb\db\driver\sqlite3' => array(
'SCHEMA' => 'sqlite',
'DELIM' => ';',
'PDO' => 'sqlite',
),
);
if (isset($available_dbms[$dbms]))
@@ -623,6 +637,14 @@ class phpbb_database_test_connection_manager
$queries[] = 'SELECT ' . implode(', ', $setval_queries);
}
break;
case 'phpbb\db\driver\sqlite3':
/**
* Just delete all of the sequences. When an insertion occurs, the sequence will be automatically
* re-created from the key with the AUTOINCREMENT attribute
*/
$queries[] = 'DELETE FROM sqlite_sequence';
break;
}
foreach ($queries as $query)

View File

@@ -116,6 +116,18 @@ class phpbb_test_case_helpers
));
}
if (extension_loaded('sqlite3') && version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>='))
{
$config = array_merge($config, array(
'dbms' => 'phpbb\db\driver\sqlite3',
'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite3', // filename
'dbport' => '',
'dbname' => '',
'dbuser' => '',
'dbpasswd' => '',
));
}
if (isset($_SERVER['PHPBB_TEST_CONFIG']))
{
// Could be an absolute path