driver fix + userguide + changelog
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 947c477..9558dfd 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -65,14 +65,15 @@
 	 */
 	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 @@
 			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);
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 827b1f0..bc88b3c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -139,8 +139,9 @@
    -  Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge <database/forge>`.
    -  Added unbuffered_row() method for getting a row without prefetching whole result (consume less memory).
    -  Added PDO support for ``list_fields()`` in :doc:`Database Results <database/results>`.
-   -  Added capability for packages to hold database.php config files 
+   -  Added capability for packages to hold database.php config files
    -  Added subdrivers support (currently only used by PDO).
+   -  Added support for client compression for MySQL and MySQLi.
 
 -  Libraries
 
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index c17de60..636b5b5 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -28,6 +28,7 @@
 		'dbcollat' => 'utf8_general_ci',
 		'swap_pre' => '',
 		'autoinit' => TRUE,
+		'compress' => TRUE,
 		'stricton' => FALSE,
 		'failover' => array()
 	);
@@ -69,6 +70,7 @@
 				'dbcollat' => 'utf8_general_ci',
 				'swap_pre' => '',
 				'autoinit' => TRUE,
+				'compress' => TRUE,
 				'stricton' => FALSE
 			),
 			array(
@@ -86,6 +88,7 @@
 				'dbcollat' => 'utf8_general_ci',
 				'swap_pre' => '',
 				'autoinit' => TRUE,
+				'compress' => TRUE,
 				'stricton' => FALSE
 			)
 		);
@@ -115,6 +118,7 @@
 		'dbcollat' => 'utf8_general_ci',
 		'swap_pre' => '',
 		'autoinit' => TRUE,
+		'compress' => TRUE,
 		'stricton' => FALSE,
 		'failover' => array()
 	);
@@ -174,11 +178,12 @@
 			customizable by the end user.
 **autoinit**		Whether or not to automatically connect to the database when the library loads. If set to false,
 			the connection will take place prior to executing the first query.
+**compress**		Whether or not to use client compression for MySQL or MySQLi.
 **stricton**		TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL
 			while developing an application.
 **port**		The database port number. To use this value you have to add a line to the database config array.
 			::
-			
+
 				$db['default']['port'] = 5432;
 ======================  ==================================================================================================