MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:uwendel Date:June 20 2007 4:24pm
Subject:PHP mysqlnd svn commit: r411 - trunk/tests/ext/mysqli
View as plain text  
Author: uwendel
Date: 2007-06-20 18:24:55 +0200 (Wed, 20 Jun 2007)
New Revision: 411

Modified:
   trunk/tests/ext/mysqli/mysqli_constants.phpt
Log:
There seem to be a few constants missing on mysqlnd builds. We need to check that in more
detail. Test fails.


Modified: trunk/tests/ext/mysqli/mysqli_constants.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_constants.phpt	2007-06-20 15:12:40 UTC (rev 410)
+++ trunk/tests/ext/mysqli/mysqli_constants.phpt	2007-06-20 16:24:55 UTC (rev 411)
@@ -4,20 +4,151 @@
 <?php require_once('skipif.inc'); ?>
 <?php require_once('skipifemb.inc'); ?>
 --FILE--
-<?php           
+<?php          
+    require("connect.inc"); 
+    require("table.inc"); 
+    
     $constants = get_defined_constants(true);
+    sort($constants);
     
+    $expected_constants = array(
+        'MYSQLI_READ_DEFAULT_GROUP'             => true,
+        'MYSQLI_READ_DEFAULT_FILE'              => true,
+        'MYSQLI_OPT_CONNECT_TIMEOUT'            => true,
+        'MYSQLI_OPT_LOCAL_INFILE'               => true,
+        'MYSQLI_INIT_COMMAND'                   => true,
+        'MYSQLI_CLIENT_SSL'                     => true,
+        "MYSQLI_CLIENT_COMPRESS"                => true,
+        "MYSQLI_CLIENT_INTERACTIVE"             => true,
+        "MYSQLI_CLIENT_IGNORE_SPACE"            => true,
+        "MYSQLI_CLIENT_NO_SCHEMA"               => true,
+        "MYSQLI_CLIENT_FOUND_ROWS"              => true,
+        "MYSQLI_STORE_RESULT"                   => true,
+        "MYSQLI_USE_RESULT"                     => true,
+        "MYSQLI_ASSOC"                          => true,
+        "MYSQLI_NUM"                            => true,
+        "MYSQLI_BOTH"                           => true,
+        "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"    => true,        
+        "MYSQLI_NOT_NULL_FLAG"                  => true,
+        "MYSQLI_PRI_KEY_FLAG"                   => true,
+        "MYSQLI_UNIQUE_KEY_FLAG"                => true,
+        "MYSQLI_MULTIPLE_KEY_FLAG"              => true,
+        "MYSQLI_BLOB_FLAG"                      => true,
+        "MYSQLI_UNSIGNED_FLAG"                  => true,
+        "MYSQLI_ZEROFILL_FLAG"                  => true,
+        "MYSQLI_AUTO_INCREMENT_FLAG"            => true,
+        "MYSQLI_TIMESTAMP_FLAG"                 => true,
+        "MYSQLI_SET_FLAG"                       => true,
+        "MYSQLI_NUM_FLAG"                       => true,
+        "MYSQLI_PART_KEY_FLAG"                  => true,
+        "MYSQLI_GROUP_FLAG"                     => true,
+        "MYSQLI_TYPE_DECIMAL"                   => true,
+        "MYSQLI_TYPE_TINY"                      => true,
+        "MYSQLI_TYPE_SHORT"                     => true,
+        "MYSQLI_TYPE_LONG"                      => true,
+        "MYSQLI_TYPE_FLOAT"                     => true,
+        "MYSQLI_TYPE_DOUBLE"                    => true,
+        "MYSQLI_TYPE_NULL"                      => true,
+        "MYSQLI_TYPE_TIMESTAMP"                 => true,
+        "MYSQLI_TYPE_LONGLONG"                  => true,
+        "MYSQLI_TYPE_INT24"                     => true,
+        "MYSQLI_TYPE_DATE"                      => true,
+        "MYSQLI_TYPE_TIME"                      => true,
+        "MYSQLI_TYPE_DATETIME"                  => true,
+        "MYSQLI_TYPE_YEAR"                      => true,
+        "MYSQLI_TYPE_NEWDATE"                   => true,
+        "MYSQLI_TYPE_ENUM"                      => true,
+        "MYSQLI_TYPE_SET"                       => true,
+        "MYSQLI_TYPE_TINY_BLOB"                 => true,
+        "MYSQLI_TYPE_MEDIUM_BLOB"               => true,
+        "MYSQLI_TYPE_LONG_BLOB"                 => true,
+        "MYSQLI_TYPE_BLOB"                      => true,
+        "MYSQLI_TYPE_VAR_STRING"                => true,
+        "MYSQLI_TYPE_STRING"                    => true,
+        "MYSQLI_TYPE_CHAR"                      => true,
+        "MYSQLI_TYPE_INTERVAL"                  => true,
+        "MYSQLI_TYPE_GEOMETRY"                  => true,        
+        "MYSQLI_NO_DATA"                        => true,        
+        "MYSQLI_REPORT_INDEX"                   => true,
+        "MYSQLI_REPORT_STRICT"                  => true,
+        "MYSQLI_REPORT_ALL"                     => true,
+        "MYSQLI_REPORT_ERROR"                   => true,
+        "MYSQLI_REPORT_OFF"                     => true,
+    );
+    
+    $version = mysqli_get_server_version($link);    
+    
+    if ($version > 50002) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_TYPE_NEWDECIMAL"                => true,
+            "MYSQLI_TYPE_BIT"                       => true,
+        ));
+    }
+    
+    if ($version > 50003) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_STMT_ATTR_CURSOR_TYPE"          => true,
+            "MYSQLI_CURSOR_TYPE_NO_CURSOR"          => true,
+            "MYSQLI_CURSOR_TYPE_READ_ONLY"          => true,
+            "MYSQLI_CURSOR_TYPE_FOR_UPDATE"         => true,
+            "MYSQLI_CURSOR_TYPE_SCROLLABLE"         => true,
+        ));
+    }
+    
+    if ($version > 50007) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_STMT_ATTR_PREFETCH_ROWS"        => true,
+        ));
+    }
+    
+    /* pretty dump test, but that is the best way to mimic mysql.c */
+    if (defined('MYSQLI_DATA_TRUNCATED'))
+        $expected_constants["MYSQLI_DATA_TRUNCATED"] = true;
+    
+    if ($IS_MYSQLND) {
+        /* mysqlnd only */
+        $expected_constants["MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE"] = true;        
+    } else {
+        /* libmysql only */
+        
+        /* are they available in all versions of ext/mysqli ? */
+        $expected_constants["MYSQLI_RPL_MASTER"]            = true;
+        $expected_constants["MYSQLI_RPL_SLAVE"]             = true;
+        $expected_constants["MYSQLI_RPL_ADMIN"]             = true;
+    }
+        
+    
+    $unexpected_constants = array();
+    
+   
+    
     foreach ($constants as $group => $consts) {        
-        foreach ($consts as $name => $value) {
-            if (stristr($name, 'mysql')) {
-                print $group;
-                break 2;
+        foreach ($consts as $name => $value) {            
+            if (stristr($name, 'mysqli')) {
+                if ('mysqli' !== $group)          
+                    printf("Found constant '%s' in group '%s'. Expecting group
'mysqli'\n", $name, $group);
+
+                $name = strtoupper($name);                    
+                if (isset($expected_constants[$name])) {
+                    unset($expected_constants[$name]);                    
+                } else {
+                    $unexpected_constants[$name] = $name;
+                }
             }
         }
+    }   
+
+    if (!empty($unexpected_constants)) {
+        printf("Dumping list of unexpected constants\n");
+        var_dump($unexpected_constants);
     }
 
+    if (!empty($expected_constants)) {
+        printf("Dumping list of missing constants\n");
+        var_dump($expected_constants);
+    }
+
     print "done!";
 ?>
 --EXPECTF--
-mysqli
-done!
+done!
\ No newline at end of file

Thread
PHP mysqlnd svn commit: r411 - trunk/tests/ext/mysqliuwendel20 Jun