uw                                       Wed, 14 Mar 2012 14:55:09 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=324242

Log:
Test for MySQL version.Variable is deprecated in MySQL 5.6.

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt
    U   php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_report.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:05:54 UTC (rev 324241)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:55:09 UTC (rev 324242)
@@ -194,37 +194,39 @@
 	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
 		printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());

-	// this might cause a warning - no index used
-	if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
-		printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+	if (mysqli_get_server_version($link) <= 50600) {
+		// this might cause a warning - no index used
+		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
+			printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	if (!$row = mysqli_fetch_assoc($res))
-		printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (!$row = mysqli_fetch_assoc($res))
+			printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	$log_slow_query = ('ON' == $row['Value']);
+		$log_slow_query = ('ON' == $row['Value']);

-	if (mysqli_get_server_version($link) >= 51011) {
-		// this might cause a warning - no index used
-		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
-			printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (mysqli_get_server_version($link) >= 50111) {
+			// this might cause a warning - no index used
+			if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
+				printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		if (!$row = mysqli_fetch_assoc($res))
-			printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			if (!$row = mysqli_fetch_assoc($res))
+				printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		$log_queries_not_using_indexes = ('ON' == $row['Value']);
+			$log_queries_not_using_indexes = ('ON' == $row['Value']);

-		if ($log_slow_queries && $log_queries_not_using_indexes) {
+			if ($log_slow_queries && $log_queries_not_using_indexes) {

-			for ($i = 100; $i < 20000; $i++) {
-				if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
-					printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
-			}
+				for ($i = 100; $i < 20000; $i++) {
+					if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
+						printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
+				}

-			// this might cause a warning - no index used
-			if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
-				printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+				// this might cause a warning - no index used
+				if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
+					printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-			mysqli_free_result($res);
+				mysqli_free_result($res);
+			}
 		}
 	}


Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:05:54 UTC (rev 324241)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:55:09 UTC (rev 324242)
@@ -194,37 +194,39 @@
 	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
 		printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());

-	// this might cause a warning - no index used
-	if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
-		printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+	if (mysqli_get_server_version($link) <= 50600) {
+		// this might cause a warning - no index used
+		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
+			printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	if (!$row = mysqli_fetch_assoc($res))
-		printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (!$row = mysqli_fetch_assoc($res))
+			printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	$log_slow_query = ('ON' == $row['Value']);
+		$log_slow_query = ('ON' == $row['Value']);

-	if (mysqli_get_server_version($link) >= 51011) {
-		// this might cause a warning - no index used
-		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
-			printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (mysqli_get_server_version($link) >= 50111) {
+			// this might cause a warning - no index used
+			if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
+				printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		if (!$row = mysqli_fetch_assoc($res))
-			printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			if (!$row = mysqli_fetch_assoc($res))
+				printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		$log_queries_not_using_indexes = ('ON' == $row['Value']);
+			$log_queries_not_using_indexes = ('ON' == $row['Value']);

-		if ($log_slow_queries && $log_queries_not_using_indexes) {
+			if ($log_slow_queries && $log_queries_not_using_indexes) {

-			for ($i = 100; $i < 20000; $i++) {
-				if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
-					printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
-			}
+				for ($i = 100; $i < 20000; $i++) {
+					if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
+						printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
+				}

-			// this might cause a warning - no index used
-			if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
-				printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+				// this might cause a warning - no index used
+				if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
+					printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-			mysqli_free_result($res);
+				mysqli_free_result($res);
+			}
 		}
 	}


Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_report.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:05:54 UTC (rev 324241)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_report.phpt	2012-03-14 14:55:09 UTC (rev 324242)
@@ -194,37 +194,39 @@
 	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
 		printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());

-	// this might cause a warning - no index used
-	if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
-		printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+	if (mysqli_get_server_version($link) <= 50600) {
+		// this might cause a warning - no index used
+		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
+			printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	if (!$row = mysqli_fetch_assoc($res))
-		printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (!$row = mysqli_fetch_assoc($res))
+			printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-	$log_slow_query = ('ON' == $row['Value']);
+		$log_slow_query = ('ON' == $row['Value']);

-	if (mysqli_get_server_version($link) >= 51011) {
-		// this might cause a warning - no index used
-		if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
-			printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+		if (mysqli_get_server_version($link) >= 50111) {
+			// this might cause a warning - no index used
+			if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
+				printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		if (!$row = mysqli_fetch_assoc($res))
-			printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			if (!$row = mysqli_fetch_assoc($res))
+				printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-		$log_queries_not_using_indexes = ('ON' == $row['Value']);
+			$log_queries_not_using_indexes = ('ON' == $row['Value']);

-		if ($log_slow_queries && $log_queries_not_using_indexes) {
+			if ($log_slow_queries && $log_queries_not_using_indexes) {

-			for ($i = 100; $i < 20000; $i++) {
-				if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
-					printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
-			}
+				for ($i = 100; $i < 20000; $i++) {
+					if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
+						printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
+				}

-			// this might cause a warning - no index used
-			if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
-				printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+				// this might cause a warning - no index used
+				if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
+					printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

-			mysqli_free_result($res);
+				mysqli_free_result($res);
+			}
 		}
 	}

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to