summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavey Shafik <me@daveyshafik.com>2016-10-03 10:28:52 -0700
committerDavey Shafik <me@daveyshafik.com>2016-10-03 10:28:52 -0700
commit5a38260835db8b75185aeb6e41b9bd688fcd8a91 (patch)
treebdb90fdbcfe16433d7f999439b9452be94cdfd89 /lib
parentcfbbe478a65a8ca8ea4ef0df2671fc1bfcfa81b8 (diff)
downloadphp7-mysql-shim-5a38260835db8b75185aeb6e41b9bd688fcd8a91.zip
php7-mysql-shim-5a38260835db8b75185aeb6e41b9bd688fcd8a91.tar.gz
php7-mysql-shim-5a38260835db8b75185aeb6e41b9bd688fcd8a91.tar.bz2
Add comments
Diffstat (limited to 'lib')
-rw-r--r--lib/mysql.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/mysql.php b/lib/mysql.php
index a777925..21d625b 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -31,12 +31,14 @@ namespace {
}
$hash = sha1($hostname . $username . $flags);
+ /* persistent connections start with p: */
if ($hostname{1} != ':' && isset(\Dshafik\MySQL::$connections[$hash])) {
\Dshafik\MySQL::$last_connection = \Dshafik\MySQL::$connections[$hash]['conn'];
\Dshafik\MySQL::$connections[$hash]['refcount'] += 1;
return \Dshafik\MySQL::$connections[$hash]['conn'];
}
+ /* No flags, means we can use mysqli_connect() */
if ($flags === 0) {
$conn = mysqli_connect($hostname, $username, $password);
if (!$conn instanceof mysqli) {
@@ -49,6 +51,7 @@ namespace {
return $conn;
}
+ /* Flags means we need to use mysqli_real_connect() instead, and handle exceptions */
try {
\Dshafik\MySQL::$last_connection = $conn = mysqli_init();