List:Commits« Previous MessageNext Message »
From:uwendel Date:March 16 2007 4:07pm
Subject:PHP mysqlnd svn commit: r180 - trunk/ext/mysqli/tests
View as plain text  
Author: uwendel
Date: 2007-03-16 17:07:56 +0100 (Fri, 16 Mar 2007)
New Revision: 180

Modified:
   trunk/ext/mysqli/tests/mysqli_connect_oo.phpt
   trunk/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
Log:
This seems to be the desired syntax.


Modified: trunk/ext/mysqli/tests/mysqli_connect_oo.phpt
===================================================================
--- trunk/ext/mysqli/tests/mysqli_connect_oo.phpt	2007-03-16 15:16:58 UTC (rev 179)
+++ trunk/ext/mysqli/tests/mysqli_connect_oo.phpt	2007-03-16 16:07:56 UTC (rev 180)
@@ -133,7 +133,9 @@
     
     ini_set('mysqli.default_host', $host);
     try {
-        $mysqli = new mysqli();                
+        /* NOTE that at this point one must use a different syntax! */
+        $mysqli = mysqli_init();
+        $mysqli->real_connect();
         assert(0 === mysqli_connect_errno());
         $mysqli->close();
         assert(0 === mysqli_connect_errno());
@@ -164,5 +166,4 @@
 Warning: mysqli::close(): Couldn't fetch mysqli in %s on line %d
 ... and now Exceptions
 Access denied for user '%s'@'%s' (using password: %s)
-
-done!
+done!
\ No newline at end of file

Modified: trunk/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
===================================================================
--- trunk/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt	2007-03-16 15:16:58 UTC (rev
179)
+++ trunk/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt	2007-03-16 16:07:56 UTC (rev
180)
@@ -18,25 +18,38 @@
     ini_set('mysqli.default_pw', $passwd);    
     ini_set('mysqli.default_user', $user);    
     ini_set('mysqli.default_host', $host);
+    /*
+    NOTE: do not try $mysqli = new mysqli() !
+    */
     try {
-        $mysqli = new mysqli();
+        $mysqli = mysqli_init();
+        $mysqli->real_connect();
+        
         if (!$res = $mysqli->query("SELECT 1"))
-            printf("[001] [%d] %s\n", $mysqli->error, $mysqli->errno);
+            printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error);
+        $res->free_result();
+        
+        if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS
username"))
+            printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
+        
+        $tmp = $res->fetch_assoc();
+        $res->free_result();
+        if ($tmp['username'] !== $user)
+            printf("[003] Expecting string/%s, got %s/%s\n", $user,
gettype($tmp['username']), $tmp['username']);
+            
         $mysqli->close();
         
     } catch (mysqli_sql_exception $e) {
         printf("%s\n", $e->getMessage());
-        printf("[002] Usage of mysqli.default_host failed\n");        
+        printf("[004] Usage of mysqli.default_host failed\n");        
     }
     
     $link = mysqli_connect();
     if (!$res = mysqli_query($link, "SELECT 1"))
-        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
     var_dump(mysqli_fetch_assoc($res));
             
-    mysqli_close($link);
-    
-    
+    mysqli_close($link);   
 
     print "done!";
 ?>

Thread
PHP mysqlnd svn commit: r180 - trunk/ext/mysqli/testsuwendel16 Mar