westdc-core/Westdc/Db/Pdo.php

25 lines
605 B
PHP
Raw Normal View History

<?php
namespace Westdc\Db;
2015-01-11 03:24:31 +00:00
use Westdc\Helpers\Config;
class Pdo extends \PDO
{
function __construct($DSN = NULL)
{
if (!empty($DSN)) {
parent::__construct($DSN);
} else {
2015-01-11 03:24:31 +00:00
$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);
}
}
}