summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-12 19:37:52 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-12 19:37:52 +0200
commit2f8bf9b4c5ee9bc183e17fd36b54be12a1bf75bb (patch)
tree2bb4e01204676f51d2814c8c4d1cc3a8501f14ff /system/database/drivers/mysql
parent9ae82faaad2f6b07a050d79129652b74483d1da0 (diff)
Set MySQL client compression to FALSE by default (problems reported with it), fix some typos, add encrypted database connections support and fix SQLSRV CharacterSet setting
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 7262591ee..336db971d 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -41,6 +41,7 @@
class CI_DB_mysql_driver extends CI_DB {
public $dbdriver = 'mysql';
+ public $compress = FALSE;
// The character used for escaping
protected $_escape_char = '`';
@@ -75,18 +76,20 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Non-persistent database connection
*
+ * @param bool
* @return resource
*/
- public function db_connect()
+ public function db_connect($persistent = FALSE)
{
- if ($this->compress === TRUE)
- {
- return @mysql_connect($this->hostname, $this->username, $this->password, TRUE, MYSQL_CLIENT_COMPRESS);
- }
- else
+ $connect_func = ($persistent === TRUE) ? 'mysql_pconnect' : 'mysql_connect';
+ $client_flags = ($this->compress === FALSE) ? 0 : MYSQL_CLIENT_COMPRESS;
+
+ if ($this->encrypt === TRUE)
{
- return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
+ $client_flags = $client_flags | MYSQL_CLIENT_SSL;
}
+
+ return @$connect_func($this->hostname, $this->username, $this->password, TRUE, $client_flags);
}
// --------------------------------------------------------------------
@@ -98,14 +101,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
public function db_pconnect()
{
- if ($this->compress === TRUE)
- {
- return @mysql_pconnect($this->hostname, $this->username, $this->password, MYSQL_CLIENT_COMPRESS);
- }
- else
- {
- return @mysql_pconnect($this->hostname, $this->username, $this->password);
- }
+ return $this->db_connect(TRUE);
}
// --------------------------------------------------------------------