List:Commits« Previous MessageNext Message »
From:uwendel Date:June 22 2007 9:53am
Subject:PHP mysqlnd svn commit: r444 - trunk/tests/ext/mysqli
View as plain text  
Author: uwendel
Date: 2007-06-22 11:53:13 +0200 (Fri, 22 Jun 2007)
New Revision: 444

Modified:
   trunk/tests/ext/mysqli/065.phpt
   trunk/tests/ext/mysqli/mysqli_set_charset.phpt
Log:
Fails, changed my mind. Probably a user-too-stupid issue, but I want to see it fixed or
documented. If I fail on it, users are likely to fail as well.


Modified: trunk/tests/ext/mysqli/065.phpt
===================================================================
--- trunk/tests/ext/mysqli/065.phpt	2007-06-22 09:20:12 UTC (rev 443)
+++ trunk/tests/ext/mysqli/065.phpt	2007-06-22 09:53:13 UTC (rev 444)
@@ -24,7 +24,7 @@
 	$len = $charset = array();
 	$tmp = null;
 
-	if (@$mysql->set_charset("latin1")) {
+	if ($mysql->set_charset("latin1")) {
 		/* 5C should be escaped */
 		if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
 		  printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp);
@@ -33,7 +33,7 @@
 		  printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp);
 	}
 
-	if (@$mysql->set_charset("gbk")) {
+	if ($mysql->set_charset("gbk")) {
 		/* nothing should be escaped, it's a valid gbk character */
 		
 		if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))

Modified: trunk/tests/ext/mysqli/mysqli_set_charset.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_set_charset.phpt	2007-06-22 09:20:12 UTC (rev 443)
+++ trunk/tests/ext/mysqli/mysqli_set_charset.phpt	2007-06-22 09:53:13 UTC (rev 444)
@@ -69,7 +69,21 @@
     mysqli_free_result($res);
     if ($new_charset !== $tmp['charset'])
         printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset,
$tmp['charset']);
+        
+    if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
+        printf("[016] Cannot get list of character sets\n");
+        
+    while ($tmp = mysqli_fetch_assoc($res)) {
+        if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link,
$tmp['Charset']))))
+            printf("[017] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'],
mysqli_errno($link), mysqli_error($link));
             
+        if (!mysqli_set_charset($link, $tmp['Charset'])) {
+            printf("[018] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'],
+                mysqli_errno($link), mysqli_error($link));
+        }                
+    }            
+    mysqli_free_result($res);
+            
     mysqli_close($link);
     
     if (NULL !== ($tmp = mysqli_set_charset($link, $new_charset)))

Thread
PHP mysqlnd svn commit: r444 - trunk/tests/ext/mysqliuwendel22 Jun