Add support for custom SQLite database path

This commit is contained in:
ASVVVAD 2020-08-19 01:12:56 +00:00 committed by Trevor Slocum
parent ec08da093a
commit 515a793464
3 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@ if (!function_exists('sqlite_open')) {
fancyDie("SQLite library is not installed");
}
if (!$db = sqlite_open('tinyib.db', 0666, $error)) {
if (!$db = sqlite_open(TINYIB_DBPATH, 0666, $error)) {
fancyDie("Could not connect to database: " . $error);
}

View File

@ -7,7 +7,7 @@ if (!extension_loaded('sqlite3')) {
fancyDie("SQLite3 extension is either not installed or loaded");
}
$db = new SQLite3('tinyib.db');
$db = new SQLite3(TINYIB_DBPATH);
if (!$db) {
fancyDie("Could not connect to database: " . $db->lastErrorMsg());
}

View File

@ -93,6 +93,10 @@ define('TINYIB_DBUSERNAME', ''); // Username
define('TINYIB_DBPASSWORD', ''); // Password
define('TINYIB_DBNAME', ''); // Database
// Database configuration - SQLite3, SQLite
// The following only apply when TINYIB_DBMODE is set to sqlite3 or sqlite
define('TINYIB_DBPATH', 'tinyib.db'); // Sqlite DB path
// Database configuration - PDO
// The following only apply when TINYIB_DBMODE is set to pdo (see README for instructions)
define('TINYIB_DBDRIVER', 'mysql'); // PDO driver to use (mysql / pgsql / sqlite / etc.)