List:Commits« Previous MessageNext Message »
From:uwendel Date:April 17 2008 5:47pm
Subject:PHP mysqlnd svn commit: r1491 - trunk/tests/ext/pdo_mysql
View as plain text  
Author: uwendel
Date: 2008-04-17 17:47:04 +0200 (Thu, 17 Apr 2008)
New Revision: 1491

Modified:
   trunk/tests/ext/pdo_mysql/pdo_mysql_stmt_nextrowset.phpt
Log:
Make it leak... memory can't get cheap enough for that:
mysql_statement.c(184) :  Freeing 0x2B3B22DFE070 (1048576 bytes)
(relax, that's PDO_MYSQL leaking not PDO_MYSQLND, but we share the code...)



Modified: trunk/tests/ext/pdo_mysql/pdo_mysql_stmt_nextrowset.phpt
===================================================================
--- trunk/tests/ext/pdo_mysql/pdo_mysql_stmt_nextrowset.phpt	2008-04-17 15:28:09 UTC (rev
1490)
+++ trunk/tests/ext/pdo_mysql/pdo_mysql_stmt_nextrowset.phpt	2008-04-17 15:47:04 UTC (rev
1491)
@@ -29,9 +29,9 @@
 
 	// TODO: should give a warning, but its PDO, let's ignore the missing warning for now
 	if (false !== ($tmp = $stmt->nextRowSet(1)))
-		printf("[002] Expecting false got %s\n", var_export($tmp, true));
+		printf("[003] Expecting false got %s\n", var_export($tmp, true));
 
-	try {
+	function test_proc1($db) {
 
 		$stmt = $db->query('SELECT @VERSION as _version');
 		$tmp = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -44,6 +44,10 @@
 		var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
 		var_dump($stmt->nextRowSet());
 
+	}
+
+	function test_proc2($db) {
+
 		$db->exec('DROP PROCEDURE IF EXISTS p');
 		$db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3;
SELECT id FROM test ORDER BY id DESC LIMIT 3; END;');
 		$stmt = $db->query('CALL p()');
@@ -52,6 +56,23 @@
 		} while ($stmt->nextRowSet());
 		var_dump($stmt->nextRowSet());
 
+	}
+
+	try {
+
+		// Emulated PS
+		printf("Emulated PS...\n");
+		$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+		test_proc1($db);
+		test_proc2($db);
+
+		// Native PS
+		printf("Native PS...\n");
+		$db = MySQLPDOTest::factory();
+		$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+		test_proc1($db);
+		test_proc2($db);
+
 		@$db->exec('DROP PROCEDURE IF EXISTS p');
 
 	} catch (PDOException $e) {
@@ -63,6 +84,7 @@
 	print "done!";
 ?>
 --EXPECTF--
+Emulated PS...
 array(1) {
   [0]=>
   array(1) {
@@ -106,4 +128,48 @@
   }
 }
 bool(false)
+Native PS...
+array(1) {
+  [0]=>
+  array(1) {
+    ["_version"]=>
+    string(%d) "%s"
+  }
+}
+bool(false)
+array(3) {
+  [0]=>
+  array(1) {
+    ["id"]=>
+    string(1) "1"
+  }
+  [1]=>
+  array(1) {
+    ["id"]=>
+    string(1) "2"
+  }
+  [2]=>
+  array(1) {
+    ["id"]=>
+    string(1) "3"
+  }
+}
+array(3) {
+  [0]=>
+  array(1) {
+    ["id"]=>
+    string(1) "3"
+  }
+  [1]=>
+  array(1) {
+    ["id"]=>
+    string(1) "2"
+  }
+  [2]=>
+  array(1) {
+    ["id"]=>
+    string(1) "1"
+  }
+}
+bool(false)
 done!
\ No newline at end of file

Thread
PHP mysqlnd svn commit: r1491 - trunk/tests/ext/pdo_mysqluwendel17 Apr