2010-01-14 21:46:47 +01:00
< ? php
2010-02-08 05:20:09 +01:00
global $databaseConfig ;
if ( defined ( 'SS_DATABASE_CLASS' )) $databaseConfig [ 'type' ] = SS_DATABASE_CLASS ;
if ( array_search ( $databaseConfig [ 'type' ], array ( 'SQLiteDatabase' , 'SQLite3Database' , 'SQLitePDODatabase' )) !== false ) {
2010-01-21 12:32:21 +01:00
2010-01-14 21:46:47 +01:00
$databaseConfig = array (
2010-02-08 05:20:09 +01:00
'type' => $databaseConfig [ 'type' ],
2010-01-14 21:46:47 +01:00
'database' => ( defined ( 'SS_DATABASE_PREFIX' ) ? SS_DATABASE_PREFIX : '' ) . $database . ( defined ( 'SS_DATABASE_SUFFIX' ) ? SS_DATABASE_SUFFIX : '' ),
2010-02-08 05:20:09 +01:00
'path' => defined ( 'SS_SQLITE_DATABASE_PATH' ) && SS_SQLITE_DATABASE_PATH ? SS_SQLITE_DATABASE_PATH : ASSETS_PATH . '/.sqlitedb/' , // where to put the database file
2010-01-22 12:48:57 +01:00
'memory' => true , // run tests in memory
2010-01-14 21:46:47 +01:00
);
2010-01-24 07:57:42 +01:00
/**
* set pragma values on the connection .
* @ see http :// www . sqlite . org / pragma . html
*/
SQLite3Database :: $default_pragma = array (
'encoding' => '"UTF-8"' ,
'locking_mode' => 'NORMAL' ,
);
2010-01-21 12:32:21 +01:00
// The SQLite3 class is available in PHP 5.3 and newer
2010-02-08 05:20:09 +01:00
if ( $databaseConfig [ 'type' ] == 'SQLitePDODatabase' || version_compare ( phpversion (), '5.3.0' , '<' )) {
2010-01-21 12:32:21 +01:00
$databaseConfig [ 'type' ] = 'SQLitePDODatabase' ;
} else {
$databaseConfig [ 'type' ] = 'SQLite3Database' ;
$databaseConfig [ 'key' ] = defined ( 'SS_SQLITE_DATABASE_KEY' ) && SS_SQLITE_DATABASE_KEY ? SS_SQLITE_DATABASE_KEY : 'SQLite3DatabaseKey' ;
}
2010-01-14 21:46:47 +01:00
}