MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:uwendel Date:September 17 2007 10:50am
Subject:PHP mysqlnd svn commit: r1050 - trunk/tests/ext/mysqli
View as plain text  
Author: uwendel
Date: 2007-09-17 12:50:29 +0200 (Mon, 17 Sep 2007)
New Revision: 1050

Added:
   trunk/tests/ext/mysqli/mysqli_pconn_limits.phpt
Log:
Like before, real_connect() has issues with the host name 
when using persistent connections.


Added: trunk/tests/ext/mysqli/mysqli_pconn_limits.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_pconn_limits.phpt	2007-09-17 10:15:12 UTC (rev 1049)
+++ trunk/tests/ext/mysqli/mysqli_pconn_limits.phpt	2007-09-17 10:50:29 UTC (rev 1050)
@@ -0,0 +1,96 @@
+--TEST--
+Persistent connections - limits (-1, unlimited)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+require_once("connect.inc");
+if (!$IS_MYSQLND)
+	die("skip mysqlnd test only");
+?>
+--INI--
+mysqli.allow_persistent=1
+mysqli.max_persistent=-1
+mysqli.max_links=-1
+--FILE--
+<?php
+	require_once("connect.inc");
+	// opens a regular connection
+	require_once("table.inc");
+
+	if (!$res = mysqli_query($link, 'SELECT "works.." as _desc'))
+		printf("[001] Cannot run query, [%d] %s\n",
+			mysqli_errno($link), mysqli_error($link));
+
+	$row = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	printf("Regular connection 1 - '%s'\n", $row['_desc']);
+
+	if (!$link2 = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[002] Cannot open second regular connection, [%d] %s\n",
+			mysqli_connect_errno(), mysqli_connect_error());
+
+	if (!$res = mysqli_query($link2, 'SELECT "works..." as _desc'))
+		printf("[003] Cannot run query, [%d] %s\n",
+			mysqli_errno($link2), mysqli_error($link2));
+
+	$row = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	printf("Regular connection 2 - '%s'\n", $row['_desc']);
+
+	$host = 'p:' . $host;
+	if (!$plink = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s, [%d] %s\n",
+			$host, $user, $db, $port, $socket,
+			mysqli_connect_errno(), mysqli_connect_error());
+
+	if (!$res = mysqli_query($plink, 'SELECT "works..." as _desc'))
+		printf("[005] Cannot run query, [%d] %s\n",
+			mysqli_errno($plink), mysqli_error($plink));
+
+	$row = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	printf("Persistent connection 1 - '%s'\n", $row['_desc']);
+
+	if (!$plink2 = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s, [%d] %s\n",
+			$host, $user, $db, $port, $socket,
+			mysqli_connect_errno(), mysqli_connect_error());
+
+	if (!$res = mysqli_query($plink2, 'SELECT "works..." as _desc'))
+		printf("[007] Cannot run query, [%d] %s\n",
+			mysqli_errno($plink2), mysqli_error($plink2));
+
+	$row = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	printf("Persistent connection 2 - '%s'\n", $row['_desc']);
+
+	$plink3 = mysqli_init();
+	if (!mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket))
+		printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s, [%d] %s\n",
+			$host, $user, $db, $port, $socket,
+			mysqli_connect_errno(), mysqli_connect_error());
+
+	if (!$res = mysqli_query($plink3, 'SELECT "works..." as _desc'))
+		printf("[009] Cannot run query, [%d] %s\n",
+			mysqli_errno($plink2), mysqli_error($plink2));
+
+	$row = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	printf("Persistent connection 3 - '%s'\n", $row['_desc']);
+
+	mysqli_close($link);
+	mysqli_close($link2);
+	mysqli_close($plink);
+	mysqli_close($plink2);
+	mysqli_close($plink3);
+	print "done!";
+?>
+--EXPECTF--
+Regular connection 1 - 'works..'
+Regular connection 2 - 'works...'
+Persistent connection 1 - 'works...'
+Persistent connection 2 - 'works...'
+Persistent connection 3 - 'works...'
+done!
\ No newline at end of file

Thread
PHP mysqlnd svn commit: r1050 - trunk/tests/ext/mysqliuwendel17 Sep