Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Added support of driver_options to Mysqli DB Driver #3163

Merged
merged 1 commit into from Dec 19, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
Expand Up @@ -166,7 +166,23 @@ public function connect()
$port = (isset($p['port'])) ? (int) $p['port'] : null;
$socket = (isset($p['socket'])) ? $p['socket'] : null;

$this->resource = new \mysqli($hostname, $username, $password, $database, $port, $socket);
$this->resource = new \mysqli();
$this->resource->init();

if (!empty($p['driver_options'])) {
foreach ($p['driver_options'] as $option => $value) {
if (is_string($option)) {
// Suppress warnings here
// Ignore it if it's not a valid constant
$option = @constant(strtoupper($option));
if ($option === null)
continue;
}
$this->resource->options($option, $value);
}
}

$this->resource->real_connect($hostname, $username, $password, $database, $port, $socket);

if ($this->resource->connect_error) {
throw new Exception\RuntimeException(
Expand Down