Skip to content
This repository

Added support of driver_options to Mysqli DB Driver #3163

Merged
merged 1 commit into from over 1 year ago

2 participants

alex347 Ralph Schindler
alex347

No description provided.

Ralph Schindler ralphschindler referenced this pull request from a commit
Ralph Schindler ralphschindler Fixup for PR #3163
Fixed PR to not use warning/error suppression
466a901
Ralph Schindler ralphschindler merged commit 75728de into from
Deleted user Unknown referenced this pull request from a commit
Ralph Schindler 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

Showing 1 unique commit by 1 author.

Dec 01, 2012
alex347 alex347 added support of driver_options to Mysqli Driver 75728de
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. +17 1 library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
18 library/Zend/Db/Adapter/Driver/Mysqli/Connection.php
@@ -166,7 +166,23 @@ public function connect()
166 166 $port = (isset($p['port'])) ? (int) $p['port'] : null;
167 167 $socket = (isset($p['socket'])) ? $p['socket'] : null;
168 168
169   - $this->resource = new \mysqli($hostname, $username, $password, $database, $port, $socket);
  169 + $this->resource = new \mysqli();
  170 + $this->resource->init();
  171 +
  172 + if (!empty($p['driver_options'])) {
  173 + foreach ($p['driver_options'] as $option => $value) {
  174 + if (is_string($option)) {
  175 + // Suppress warnings here
  176 + // Ignore it if it's not a valid constant
  177 + $option = @constant(strtoupper($option));
  178 + if ($option === null)
  179 + continue;
  180 + }
  181 + $this->resource->options($option, $value);
  182 + }
  183 + }
  184 +
  185 + $this->resource->real_connect($hostname, $username, $password, $database, $port, $socket);
170 186
171 187 if ($this->resource->connect_error) {
172 188 throw new Exception\RuntimeException(

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.