/** * Constructor for MySql driver * * @param array $options * * @throws Exception */ public function __construct($options) { if (!array_key_exists("Dbchar", $options)) { $options["dbchar"] = "utf8"; } parent::__construct($options); $auto_connect = array_key_exists('auto_connect', $options) ? $options["auto_connect"] : true; if ($auto_connect) { $this->dbconn = @new mysqli($this->dbhost, $this->dbuser, $this->dbpass, $this->dbname); if ($this->dbconn->connect_errno) { $this->error($this->dbconn->connect_errno, $this->dbconn->connect_error); if (count($this->errors)) { throw new Exception($this->dbconn->connect_error, $this->dbconn->connect_errno); } else { throw new Exception("Unknown error!"); } } } }
/** * Constructor for Oracle driver * * @param array $options * * @throws Exception */ public function __construct($options) { if (!array_key_exists("Dbchar", $options)) { $options["dbchar"] = "AL32UTF8"; } parent::__construct($options); $auto_connect = array_key_exists('auto_connect', $options) ? $options["auto_connect"] : true; if ($auto_connect) { $connection_string = is_null($this->dbhost) || empty($this->dbhost) ? $this->dbname : $this->dbhost . "/" . $this->dbname; $this->dbconn = @oci_connect($this->dbuser, $this->dbpass, $connection_string, $this->dbchar); if ($this->dbconn === false) { $error = oci_error(); $this->error($error["code"], $error["message"]); if (count($this->errors)) { throw new Exception($error["message"], $error["code"]); } else { throw new Exception("Unknown error!"); } } } }