You are here

public function QPDB::dbInit in QueryPath 6

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

File

QueryPath/Extension/QPDB.php, line 47

Class

QPDB

Code

public function dbInit($dsn, $options = array()) {
  $this->opts = $options + array(
    'username' => NULL,
    'password' => NULL,
    'db params' => array(
      PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    ),
  );
  $this->dsn = $dsn;
  $this->db = new PDO($dsn, $this->opts['username'], $this->opts['password'], $this->opts['db params']);
  return $this->qp;
}