You are here

static function QPDB::baseDB in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/Extension/QPDB.php \QPDB::baseDB()
  2. 7.2 QueryPath/Extension/QPDB.php \QPDB::baseDB()

File

QueryPath/Extension/QPDB.php, line 16

Class

QPDB

Code

static function baseDB($dsn, $options = array()) {
  $opts = $options + array(
    'username' => NULL,
    'password' => NULL,
    'db params' => array(
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    ),
  );
  if ($dsn instanceof PDO) {
    self::$con = $dsn;
    return;
  }
  self::$con = new PDO($dsn, $opts['username'], $opts['password'], $opts['db params']);
}