| Server IP : 217.160.0.212 / Your IP : 216.73.216.131 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/php/Doctrine/DBAL/Driver/SQLite3/ |
Upload File : |
<?php
namespace Doctrine\DBAL\Driver\SQLite3;
use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
use Doctrine\DBAL\Driver\API\SQLite\UserDefinedFunctions;
use SensitiveParameter;
use SQLite3;
final class Driver extends AbstractSQLiteDriver
{
/**
* {@inheritdoc}
*/
public function connect(
#[SensitiveParameter]
array $params
): Connection {
$isMemory = (bool) ($params['memory'] ?? false);
if (isset($params['path'])) {
if ($isMemory) {
throw new Exception(
'Invalid connection settings: specifying both parameters "path" and "memory" is ambiguous.',
);
}
$filename = $params['path'];
} elseif ($isMemory) {
$filename = ':memory:';
} else {
throw new Exception(
'Invalid connection settings: specify either the "path" or the "memory" parameter for SQLite3.',
);
}
try {
$connection = new SQLite3($filename);
} catch (\Exception $e) {
throw Exception::new($e);
}
$connection->enableExceptions(true);
UserDefinedFunctions::register([$connection, 'createFunction']);
return new Connection($connection);
}
}