diff options
author | Ahmad Anbar <aanbar@gmail.com> | 2015-01-11 18:39:06 +0100 |
---|---|---|
committer | Ahmad Anbar <aanbar@gmail.com> | 2015-01-11 18:39:06 +0100 |
commit | c8e1de74b139dc7f3e776f7ebf98495ec5b780a6 (patch) | |
tree | 51709a1855d570ba495d81a172a029015341c2bd /system/database/drivers/mysqli/mysqli_driver.php | |
parent | faa4890addbaa90254ef160813a08f727d069415 (diff) | |
parent | 99f31e76bd06876cd3bf789f9d2774f79818b7df (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_driver.php')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index d20dcc948..4f58e836d 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.3.0 @@ -106,10 +106,22 @@ class CI_DB_mysqli_driver extends CI_DB { */ public function db_connect($persistent = FALSE) { - // Persistent connection support was added in PHP 5.3.0 - $hostname = ($persistent === TRUE && is_php('5.3')) - ? 'p:'.$this->hostname : $this->hostname; - $port = empty($this->port) ? NULL : $this->port; + // Do we have a socket path? + if ($this->hostname[0] === '/') + { + $hostname = NULL; + $port = NULL; + $socket = $this->hostname; + } + else + { + // Persistent connection support was added in PHP 5.3.0 + $hostname = ($persistent === TRUE && is_php('5.3')) + ? 'p:'.$this->hostname : $this->hostname; + $port = empty($this->port) ? NULL : $this->port; + $socket = NULL; + } + $client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0; $mysqli = mysqli_init(); @@ -118,7 +130,7 @@ class CI_DB_mysqli_driver extends CI_DB { $mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"'); } - return $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, NULL, $client_flags) + return $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags) ? $mysqli : FALSE; } |