Merge branch 'master' of http://gitlab.edu.yar.ru/composer/PHP_Library
# Conflicts: # src/Filter/Login.php # src/View/Page.php
This commit is contained in:
commit
1660f8fa06
10 changed files with 56 additions and 27 deletions
|
|
@ -13,8 +13,14 @@ class Database extends PDO
|
|||
{
|
||||
parent::__construct($dsn, $username, $password);
|
||||
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$this->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Database_PDOStatement', array()));
|
||||
}
|
||||
|
||||
function prepare($sql, $args = []) {
|
||||
$result = parent::prepare($sql, $args);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getDSN()
|
||||
{
|
||||
|
|
@ -35,6 +41,10 @@ class Database extends PDO
|
|||
if ($dsn['phptype'] == 'pgsql') {
|
||||
$connection->query('SET client_encoding="UTF-8"');
|
||||
}
|
||||
|
||||
if (isset($dsn['schema'])) {
|
||||
$connection->query('SET search_path TO ' . $dsn['schema']);
|
||||
}
|
||||
}
|
||||
if ($dsn['phptype'] == 'sqlite') {
|
||||
/*.Database.*/$connection = new static("{$dsn['phptype']}:{$dsn['database']}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue