PostgresqlDriver
Configuaration
'db' => [
'db_driver' => 'pgsql',
'db_host' => 'localhost',
'db_port' => 5432,
'db_username' => 'root',
'db_password' => '',
'db_database' => 'cms.vn',
'db_charset' => 'utf8mb4',
'db_collate' => 'utf8mb4_unicode_ci',
],__construct()
__construct()<?php
public function __construct($config) {
try {
$dsn = 'pgsql:host=' . $config['db_host'] . ';dbname=' . $config['db_database'];
$this->pdo = new PDO($dsn, $config['db_username'], $config['db_password']);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
throw new \System\Core\AppException("Connect PostgresqlDriver failed: " . $e->getMessage(), 500);
}
}query()
query()lastInsertId()
lastInsertId()count()
count()fetchAll()
fetchAll()fetchPagination()
fetchPagination()fetchRow()
fetchRow()insert()
insert()update()
update()delete()
delete()Last updated
Was this helpful?