summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-12 19:51:39 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-12 19:51:39 +0200
commitf83c4363b5459d294255e3817a230258861ec79b (patch)
treee88929ac21246cab365d865ccc82aed56663a414 /system/database/drivers/mysql
parenta23e10fd2369cc85c4b942c5de6a8cf05a5b2b67 (diff)
parent98ebf4351f8aad58504cd7318ddd94faf0dec482 (diff)
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into feature/db_qb_aliasing
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php27
1 files changed, 12 insertions, 15 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 60bcf3cfc..ce9f73011 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,21 @@ 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
+ $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 ($persistent === TRUE)
+ ? @mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags)
+ : @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags);
}
// --------------------------------------------------------------------
@@ -98,14 +102,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);
}
// --------------------------------------------------------------------