// Allow PDO options to be overridden.
$connection_options +=
[ 'pdo' =>
[],
];
$connection_options['pdo'
] +=
[ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
// Convert numeric values to strings when fetching.
\PDO::ATTR_STRINGIFY_FETCHES => TRUE,
];
try { $pdo =
new PDOConnection('sqlite:' .
$connection_options['database'
], '', '',
$connection_options['pdo'
]);
} catch (\PDOException
$e) { if ($e->
getCode() ==
static::DATABASE_NOT_FOUND
) { throw new DatabaseNotFoundException($e->
getMessage(),
$e->
getCode(),
$e);
} // SQLite doesn't have a distinct error code for access denied, so don't
// deal with that case.
throw $e;
} // Create functions needed by SQLite.