set pdo attributes in constructor
This commit is contained in:
parent
f63bfe21bc
commit
0ba76adc1d
1 changed files with 6 additions and 8 deletions
|
@ -46,7 +46,12 @@ class DB
|
|||
// Username
|
||||
Config::get('mysql_user'),
|
||||
// Password
|
||||
Config::get_safe('mysql_pass', '')
|
||||
Config::get_safe('mysql_pass', ''),
|
||||
// Set attributes
|
||||
[
|
||||
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
|
||||
\PDO::ATTR_EMULATE_PREPARES => false
|
||||
]
|
||||
);
|
||||
|
||||
$this->_PDO->exec(
|
||||
|
@ -59,13 +64,6 @@ class DB
|
|||
} catch (PDOException $e) {
|
||||
throw new DBException($e->getMessage());
|
||||
}
|
||||
|
||||
// When is this not set, chat does dot work, odd behavior
|
||||
$this->_PDO->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
|
||||
|
||||
// Throwing exceptions
|
||||
$this->_PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
//$this->_PDO->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
}
|
||||
|
||||
// Just flattern array to be binded : [key1, key2, [key3, [key4]]] => [key1, key2, key3, key4]
|
||||
|
|
Loading…
Reference in a new issue