Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added support of driver_options to Mysqli DB Driver #3163

Merged
merged 1 commit into from

2 participants

@alex347

No description provided.

@ralphschindler ralphschindler referenced this pull request from a commit
@ralphschindler ralphschindler Fixup for PR #3163
Fixed PR to not use warning/error suppression
466a901
@ralphschindler ralphschindler merged commit 75728de into zendframework:master

1 check failed

Details default The Travis build failed
@ghost Unknown referenced this pull request from a commit
@ralphschindler ralphschindler Fixup for PR #3163
Fixed PR to not use warning/error suppression
460840e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 1, 2012
  1. @alex347
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 1 deletion.
  1. +17 −1 library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
View
18 library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
@@ -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(
Something went wrong with that request. Please try again.