Author: uwendel
Date: 2007-03-20 16:00:48 +0100 (Tue, 20 Mar 2007)
New Revision: 207
Modified:
trunk/ext/mysqli/tests/mysqli_get_charset.phpt
Log:
Portability: make it work on servers that do not report a Description/Comment
Modified: trunk/ext/mysqli/tests/mysqli_get_charset.phpt
===================================================================
--- trunk/ext/mysqli/tests/mysqli_get_charset.phpt 2007-03-20 11:09:23 UTC (rev 206)
+++ trunk/ext/mysqli/tests/mysqli_get_charset.phpt 2007-03-20 15:00:48 UTC (rev 207)
@@ -43,12 +43,14 @@
if (!($character_set_connection = $tmp['charset']) || !($collation_connection =
$tmp['collation']))
printf("[008] Cannot determine current character set and collation\n");
- if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"',
$character_set_connection)))
+ if (!$res = mysqli_query($link, $sql = sprintf('SHOW CHARACTER SET LIKE "%s"',
$character_set_connection)))
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($maxlen = $tmp['Maxlen']) || !($comment = $tmp['Description']))
- printf("[010] Cannot fetch Maxlen and/or Comment, test will fail\n");
+ if (empty($tmp))
+ printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n");
+
+ $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : '';
+ $comment = (isset($tmp['Description'])) ? $tmp['Description'] : '';
if (!$res = mysqli_query($link, sprintf('SHOW COLLATION LIKE "%s"',
$collation_connection)))
printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
| Thread |
|---|
| • PHP mysqlnd svn commit: r207 - trunk/ext/mysqli/tests | uwendel | 20 Mar |