‪TYPO3CMS  9.5
Driver.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Doctrine\DBAL\DBALException;
20 use Doctrine\DBAL\Driver\PDOSqlite\Driver as DoctrinePDOSqliteDriver;
21 use PDOException;
23 
28 class ‪Driver extends DoctrinePDOSqliteDriver
29 {
33  public function ‪connect(array $params, $username = null, $password = null, array $driverOptions = [])
34  {
35  if (isset($driverOptions['userDefinedFunctions'])) {
36  $this->_userDefinedFunctions = array_merge(
37  $this->_userDefinedFunctions,
38  $driverOptions['userDefinedFunctions']
39  );
40  unset($driverOptions['userDefinedFunctions']);
41  }
42 
43  try {
44  $pdo = new ‪PDOConnection(
45  $this->_constructPdoDsn($params),
46  $username,
47  $password,
48  $driverOptions
49  );
50  } catch (PDOException $ex) {
51  throw DBALException::driverException($this, $ex);
52  }
53 
54  foreach ($this->_userDefinedFunctions as $fn => $data) {
55  $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']);
56  }
57 
58  return $pdo;
59  }
60 }
‪TYPO3\CMS\Core\Database\Driver\PDOSqlite
Definition: Driver.php:4
‪TYPO3\CMS\Core\Database\Driver\PDOSqlite\Driver
Definition: Driver.php:29
‪TYPO3\CMS\Core\Database\Driver\PDOConnection
Definition: PDOConnection.php:28
‪TYPO3\CMS\Core\Database\Driver\PDOSqlite\Driver\connect
‪connect(array $params, $username=null, $password=null, array $driverOptions=[])
Definition: Driver.php:33