25 lines
605 B
PHP
25 lines
605 B
PHP
<?php
|
|
namespace Westdc\Db;
|
|
|
|
use Westdc\Helpers\Config;
|
|
|
|
class Pdo extends \PDO
|
|
{
|
|
|
|
function __construct($DSN = NULL)
|
|
{
|
|
if (!empty($DSN)) {
|
|
parent::__construct($DSN);
|
|
} else {
|
|
$config_local = Config::get('local');
|
|
|
|
$dsn = "pgsql:host={$config_local->db->hostname};"
|
|
. "port={$config_local->db->port};"
|
|
. "dbname={$config_local->db->database};"
|
|
. "user={$config_local->db->username};"
|
|
. "password={$config_local->db->password}";
|
|
parent::__construct($dsn);
|
|
}
|
|
}
|
|
|
|
} |