List:Commits« Previous MessageNext Message »
From:ahristov Date:July 13 2007 1:46pm
Subject:PHP mysqlnd svn commit: r752 - trunk/tests/ext/mysqli
View as plain text  
Author: ahristov
Date: 2007-07-13 15:46:59 +0200 (Fri, 13 Jul 2007)
New Revision: 752

Modified:
   trunk/tests/ext/mysqli/mysqli_stmt_insert_id.phpt
Log:
Fix test so it will work with MySQL 4.1 in which ALTER TABLE
is not supported by the PS protocol.


Modified: trunk/tests/ext/mysqli/mysqli_stmt_insert_id.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_stmt_insert_id.phpt	2007-07-12 20:15:51 UTC (rev 751)
+++ trunk/tests/ext/mysqli/mysqli_stmt_insert_id.phpt	2007-07-13 13:46:59 UTC (rev 752)
@@ -42,10 +42,14 @@
     if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
         printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
         
-    if (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL
AUTO_INCREMENT") ||
-        !mysqli_stmt_execute($stmt)) {
+    if (mysqli_get_server_version($link) > 50000 && 
+	    (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL
AUTO_INCREMENT") ||
+        !mysqli_stmt_execute($stmt))) {
         printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-    }
+    } else if (mysqli_get_server_version($link) < 50000){
+		mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT");
+	}
+
     if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") ||
         !mysqli_stmt_execute($stmt)) {
         printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
@@ -63,4 +67,4 @@
 --EXPECTF--
 Warning: mysqli_stmt_insert_id(): Couldn't fetch mysqli_stmt in %s on line %d
 NULL
-done!
\ No newline at end of file
+done!

Thread
PHP mysqlnd svn commit: r752 - trunk/tests/ext/mysqliahristov13 Jul