MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:uwendel Date:July 5 2007 10:28am
Subject:PHP mysqlnd svn commit: r646 - trunk/tests/ext/mysql
View as plain text  
Author: uwendel
Date: 2007-07-05 12:28:52 +0200 (Thu, 05 Jul 2007)
New Revision: 646

Modified:
   trunk/tests/ext/mysql/mysql_field_flags.phpt
Log:
Again, mysqlnd and libmysql agree that the return value is MySQL server version dependent.


Modified: trunk/tests/ext/mysql/mysql_field_flags.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_field_flags.phpt	2007-07-05 10:25:31 UTC (rev 645)
+++ trunk/tests/ext/mysql/mysql_field_flags.phpt	2007-07-05 10:28:52 UTC (rev 646)
@@ -39,10 +39,15 @@
     
     mysql_free_result($res);
     
+    $version = mysql_get_server_info($link);    
+    if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches))
+        printf("[009] Cannot get server version\n");
+    $version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3];
+    
     $tables = array(
         'label INT, UNIQUE KEY (label)'                         =>  array(
                                                                     array('label', '1'),
-                                                                    'label' =>
array('unique_key')
+                                                                    'label' =>
array(($version < 500) ? 'multiple_key' : 'unique_key')
                                                                     ),
         'labela INT, label2 CHAR(1), KEY keyname (labela, label2)'      =>  array(
                                                                     array('labela,
label2', '1, "a"'),
@@ -82,7 +87,7 @@
     
     foreach ($tables as $columns => $expected) {
         if (!mysql_query("DROP TABLE IF EXISTS test", $link)) {
-            printf("[009/%s] [%d] %s\n", $columns, mysql_errno($link),
mysql_error($link));
+            printf("[010/%s] [%d] %s\n", $columns, mysql_errno($link),
mysql_error($link));
             continue;
         }
         $sql = sprintf("CREATE TABLE test(id INT, %s) ENGINE = %s", $columns, $engine);
@@ -95,12 +100,12 @@
         list($k, $values) = each($expected);
         $sql = sprintf("INSERT INTO test(id, %s) VALUES (1, %s)", $values[0],
$values[1]);
         if (!mysql_query($sql, $link)) {
-            printf("[010/%s] '%s', [%d] %s\n", $columns, $sql, mysql_errno($link),
mysql_error($link));
+            printf("[011/%s] '%s', [%d] %s\n", $columns, $sql, mysql_errno($link),
mysql_error($link));
             continue;
         }
         
         if (!$res = mysql_query(sprintf("SELECT id, %s FROM test", $values[0]), $link)) {
-            printf("[011/%s] [%d] %s\n", $columns, mysql_errno($link),
mysql_error($link));
+            printf("[012/%s] [%d] %s\n", $columns, mysql_errno($link),
mysql_error($link));
             continue;
         }
         
@@ -110,14 +115,14 @@
             
             foreach ($flags as $k => $flag) {
                 if (!preg_match(sprintf('@\s*%s\s*@ismU', $flag), $tmp)) {
-                    printf("[012/%s] Field '%s', flag '%s' not found, [%d] %s\n",
$columns, $field, $flag, mysql_errno($link), mysql_error($link));
+                    printf("[013/%s] Field '%s', flag '%s' not found, [%d] %s\n",
$columns, $field, $flag, mysql_errno($link), mysql_error($link));
                 }
             }
             foreach ($flags as $k => $flag) {
                 $tmp = preg_replace(sprintf('@\s*%s\s*@ismU', $flag), '', $tmp);
             }
             if ('' != $tmp)
-                printf("[013/%s] Field '%s', unexpected flags '%s' not found, [%d] %s\n",
$columns, $field, $tmp, mysql_errno($link), mysql_error($link));            
+                printf("[014/%s] Field '%s', unexpected flags '%s' found, [%d] %s\n",
$columns, $field, $tmp, mysql_errno($link), mysql_error($link));            
                        
         }
         mysql_free_result($res);

Thread
PHP mysqlnd svn commit: r646 - trunk/tests/ext/mysqluwendel5 Jul