eee
This commit is contained in:
+19
-10
@@ -352,16 +352,25 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function newConnect(): PDO
|
public function newConnect(): PDO
|
||||||
{
|
{
|
||||||
$pdo = new PDO('mysql:dbname=' . $this->database . ';host=' . $this->cds,
|
$pdo = new PDO('mysql:dbname=' . $this->database . ';host=' . $this->cds, $this->username, $this->password, [
|
||||||
$this->username, $this->password, [
|
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
||||||
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
||||||
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
PDO::ATTR_EMULATE_PREPARES => true,
|
||||||
PDO::ATTR_EMULATE_PREPARES => true,
|
PDO::ATTR_TIMEOUT => $this->timeout,
|
||||||
PDO::ATTR_TIMEOUT => $this->timeout,
|
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $this->charset
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $this->charset
|
]);
|
||||||
]);
|
return $this->setAttributes($pdo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PDO $pdo
|
||||||
|
* @return PDO
|
||||||
|
*/
|
||||||
|
protected function setAttributes(PDO $pdo): PDO
|
||||||
|
{
|
||||||
foreach ($this->attributes as $key => $attribute) {
|
foreach ($this->attributes as $key => $attribute) {
|
||||||
$pdo->setAttribute($key, $attribute);
|
$pdo->setAttribute($key, $attribute);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user