diff options
author | Alex Bilbie <alex@alexbilbie.com> | 2012-08-31 01:41:29 +0200 |
---|---|---|
committer | Alex Bilbie <alex@alexbilbie.com> | 2012-08-31 01:41:29 +0200 |
commit | b7c5444de271fb524f8a21d57f384fc0735175c0 (patch) | |
tree | 02595852a2e320452a67596b50ee531a3ad1db88 /system/database/drivers/mysqli | |
parent | 20ff7666f11f19c39cd91bd42a3b88293b8e9a26 (diff) | |
parent | 9819cba2138ce1c32aa1e8a7d5938d03b4becc3e (diff) |
Merge pull request #1732 from IT-Can/mysql-compression
MySQL & MySQLi client compression
Diffstat (limited to 'system/database/drivers/mysqli')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index be61aab20..9558dfd86 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -65,6 +65,17 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function db_connect() { + // Use MySQL client compression? + if ($this->compress === TRUE) + { + $port = empty($this->port) ? NULL : $this->port; + + $mysqli = mysqli_init(); + $mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + + return $mysqli; + } + return empty($this->port) ? @new mysqli($this->hostname, $this->username, $this->password, $this->database) : @new mysqli($this->hostname, $this->username, $this->password, $this->database, $this->port); @@ -85,6 +96,17 @@ class CI_DB_mysqli_driver extends CI_DB { return $this->db_connect(); } + // Use MySQL client compression? + if ($this->compress === TRUE) + { + $port = empty($this->port) ? NULL : $this->port; + + $mysqli = mysqli_init(); + $mysqli->real_connect('p:'.$this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + + return $mysqli; + } + return empty($this->port) ? @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database) : @new mysqli('p:'.$this->hostname, $this->username, $this->password, $this->database, $this->port); |