feat: sqlite in memory db

This commit is contained in:
origami11@yandex.ru 2024-11-14 12:04:09 +03:00
parent d692538163
commit f599a68529

View file

@ -57,8 +57,10 @@ class Database extends PDO
if (isset($dsn['schema'])) {
$connection->query('SET search_path TO ' . $dsn['schema']);
}
}
if ($dsn['phptype'] == 'sqlite') {
} elseif ($dsn['phptype'] == 'sqlite::memory') {
$connection = new self("{$dsn['phptype']}:");
$connection->sqliteCreateFunction('LOWER', 'sqliteLower', 1);
} elseif ($dsn['phptype'] == 'sqlite') {
$connection/*: Database*/ = new self("{$dsn['phptype']}:{$dsn['database']}");
$connection->setAttribute(PDO::ATTR_TIMEOUT, 5);
$mode = defined('SQLITE_JOURNAL_MODE') ? SQLITE_JOURNAL_MODE : 'WAL';