List:Commits« Previous MessageNext Message »
From:ahristov Date:July 19 2007 3:31pm
Subject:PHP mysqlnd svn commit: r803 - trunk/tests/ext/mysqli
View as plain text  
Author: ahristov
Date: 2007-07-19 17:31:56 +0200 (Thu, 19 Jul 2007)
New Revision: 803

Modified:
   trunk/tests/ext/mysqli/mysqli_explain_metadata.phpt
Log:
Fix explain_metadata test, not bugs in mysqlnd.
- If you call mysqli_stmt_get_result() then 
mysqli_stmt_num_rows() will return 0, because the stmt
doesn't own anymore the result set.

- A result set that is for metadata, is a bit fake, has
  no data, but one can call the metadata function on it.

- max_length differs, as it gets updated in the client.
  Unset it to check for real changes


Modified: trunk/tests/ext/mysqli/mysqli_explain_metadata.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_explain_metadata.phpt	2007-07-19 14:48:54 UTC (rev 802)
+++ trunk/tests/ext/mysqli/mysqli_explain_metadata.phpt	2007-07-19 15:31:56 UTC (rev 803)
@@ -42,8 +42,7 @@
 	}
 
 	foreach ($fields as $k => $field) {
-		var_dump($field);
-		var_dump($field_names[$field->name]);
+		$field->max_length = 0;// change it or we will get diff error
 		if (isset($field_names[$field->name])) {
 			unset($field_names[$field->name]);
 		} else {
@@ -75,10 +74,6 @@
 			printf("[011] Expecting int/%d got %s/%s\n",
 				$num_fields, gettype($tmp), $tmp);
 		}
-		if (($tmp = mysqli_num_rows($res_meta)) !== $num_rows) {
-			printf("[012] Expecting int/%d got %s/%s\n",
-				$num_rows, gettype($tmp), $tmp);
-		}
 		if (($tmp = mysqli_field_count($link)) !== $num_fields) {
 			printf("[013] Expecting int/%d got %s/%s\n",
 				$num_fields, gettype($tmp), $tmp);
@@ -109,9 +104,8 @@
 				printf("[018] Expecting int/%d got %s/%s\n",
 					$num_rows, gettype($tmp), $tmp);
 			}
-			if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
-				printf("[019] Expecting int/%d got %s/%s\n",
-					$num_rows, gettype($tmp), $tmp);
+			if ((mysqli_stmt_num_rows($stmt)) !== 0) {
+				printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
 			}
 			if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
 				printf("[020] Expecting int/%d got %s/%s\n",
@@ -128,11 +122,24 @@
 				printf("[022] Expecting int/%d got %s/%s\n",
 					$num_fields, gettype($tmp), $tmp);
 			}
+			reset($fields);
+			foreach ($fields_stmt as $fields_stmt_val) {
+				list(,$fields_val) = each($fields);
+				unset($fields_stmt_val->max_length);
+				unset($fields_val->max_length);
+				if ($fields_stmt_val != $fields_val) {
+					printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
+					var_dump($fields_stmt_val);
+					var_dump($fields_val);
+				}
+			}
+/*
 			if ($fields_stmt != $fields) {
 				printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
 				var_dump($fields_stmt);
 				var_dump($fields);
 			}
+*/
 			mysqli_free_result($res_stmt);
 		}
 	}
@@ -142,4 +149,4 @@
 	print "done!";
 ?>
 --EXPECTF--
-done!
\ No newline at end of file
+done!

Thread
PHP mysqlnd svn commit: r803 - trunk/tests/ext/mysqliahristov19 Jul