From c27721fbd02511c168f4c353e4f5eac1b2049e9f Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Mon, 20 Aug 2012 18:34:24 +0200 Subject: compression test --- system/database/drivers/mysqli/mysqli_driver.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index be61aab20..475857c84 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -65,6 +65,14 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function db_connect() { + if ($this->compress === TRUE) + { + $port = NULL; + + $mysqli = mysqli_init(); + return $mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + } + 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); -- cgit v1.2.3-24-g4f1b From 49f7b729b3633d7f29029b7800dde5cc47a022c8 Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Mon, 20 Aug 2012 18:52:21 +0200 Subject: mysql driver updated --- system/database/drivers/mysqli/mysqli_driver.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 475857c84..947c47784 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -67,10 +67,12 @@ class CI_DB_mysqli_driver extends CI_DB { { if ($this->compress === TRUE) { - $port = NULL; + $port = empty($this->port) ? NULL : $this->port; - $mysqli = mysqli_init(); - return $mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + $link = mysqli_init(); + $link->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + + return $link; } return empty($this->port) -- cgit v1.2.3-24-g4f1b From cdb481b92de54f7069039f6d0aa92b32c4e543fa Mon Sep 17 00:00:00 2001 From: Michiel Vugteveen Date: Tue, 21 Aug 2012 10:11:16 +0200 Subject: driver fix + userguide + changelog --- system/database/drivers/mysqli/mysqli_driver.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 947c47784..9558dfd86 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -65,14 +65,15 @@ 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; - $link = mysqli_init(); - $link->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); + $mysqli = mysqli_init(); + $mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); - return $link; + return $mysqli; } return empty($this->port) @@ -95,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); -- cgit v1.2.3-24-g4f1b From 2ea33c37e9bfa3ff0e029c18a0d2c9ef05016bf0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 4 Oct 2012 12:37:51 +0300 Subject: Fix issue #1789 Signed-off-by: Andrey Andreev --- system/database/drivers/mysqli/mysqli_driver.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 9558dfd86..453ddcc3f 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -45,10 +45,6 @@ class CI_DB_mysqli_driver extends CI_DB { // The character used for escaping protected $_escape_char = '`'; - // clause and character used for LIKE escape sequences - not used in MySQL - protected $_like_escape_str = ''; - protected $_like_escape_chr = '\\'; - protected $_random_keyword = ' RAND()'; // database specific random keyword /** -- cgit v1.2.3-24-g4f1b From dbad54e09a39a77c7404dee9ca1a6b34299469d0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 5 Oct 2012 21:53:32 +0300 Subject: Fix issue #1765 --- system/database/drivers/mysqli/mysqli_driver.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 453ddcc3f..14949ecda 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -66,8 +66,8 @@ class CI_DB_mysqli_driver extends CI_DB { { $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); + $mysqli = new mysqli(); + @$mysqli->real_connect($this->hostname, $this->username, $this->password, $this->database, $port, NULL, MYSQLI_CLIENT_COMPRESS); return $mysqli; } @@ -418,6 +418,14 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function error() { + if ( ! empty($this->conn_id->connect_errno)) + { + return array( + 'code' => $this->conn_id->connect_errno, + 'message' => is_php('5.2.9') ? $this->conn_id->connect_error : mysqli_connect_error() + ); + } + return array('code' => $this->conn_id->errno, 'message' => $this->conn_id->error); } -- cgit v1.2.3-24-g4f1b From 7eaa14f144f9aeab8fc388b6bed3390e5f815508 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 9 Oct 2012 11:34:01 +0300 Subject: Alter fix for issue #1257 --- system/database/drivers/mysqli/mysqli_driver.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 14949ecda..291ad16f2 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -474,6 +474,26 @@ class CI_DB_mysqli_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * FROM tables + * + * Groups tables in FROM clauses if needed, so there is no confusion + * about operator precedence. + * + * @return string + */ + protected function _from_tables() + { + if ( ! empty($this->qb_join) && count($this->qb_from) > 0) + { + return '('.implode(', ', $this->qb_from).')'; + } + + return implode(', ', $this->qb_from); + } + + // -------------------------------------------------------------------- + /** * Close DB Connection * -- cgit v1.2.3-24-g4f1b From fce9abe379cd273262d5e3dcbbb169ffd090506a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 9 Oct 2012 11:37:00 +0300 Subject: Really fix that FROM group condition --- system/database/drivers/mysqli/mysqli_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/database/drivers/mysqli/mysqli_driver.php') diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 291ad16f2..b5a1e26ed 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -484,7 +484,7 @@ class CI_DB_mysqli_driver extends CI_DB { */ protected function _from_tables() { - if ( ! empty($this->qb_join) && count($this->qb_from) > 0) + if ( ! empty($this->qb_join) && count($this->qb_from) > 1) { return '('.implode(', ', $this->qb_from).')'; } -- cgit v1.2.3-24-g4f1b