Author: uwendel
Date: 2007-07-04 15:07:55 +0200 (Wed, 04 Jul 2007)
New Revision: 630
Modified:
trunk/tests/ext/mysql/mysql_query.phpt
Log:
Don't dump results and have them in the [U]EXPECTF sections when you plan to run the test
on server versions not supporting the query that generates the results...
Modified: trunk/tests/ext/mysql/mysql_query.phpt
===================================================================
--- trunk/tests/ext/mysql/mysql_query.phpt 2007-07-04 13:03:14 UTC (rev 629)
+++ trunk/tests/ext/mysql/mysql_query.phpt 2007-07-04 13:07:55 UTC (rev 630)
@@ -42,20 +42,36 @@
// let's try to play with stored procedures
if (mysql_query('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT
VERSION() INTO ver_param; END;', $link)) {
$res = mysql_query('CALL p(@version)', $link);
- $res = mysql_query('SELECT @version AS p_version', $link);
- var_dump(mysql_fetch_assoc($res));
+ $res = mysql_query('SELECT @version AS p_version', $link);
+ $tmp = mysql_fetch_assoc($res);
+ if (!isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[009] Result seems wrong, dumping\n");
+ var_dump($tmp);
+ }
+ if (ini_get('unicode.semantics') && !is_unicode($tmp['p_version'])) {
+ printf("[010] Expecting unicode string, dumping\n");
+ var_dump($tmp);
+ }
mysql_free_result($res);
} else {
- printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link));
+ printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
mysql_query('DROP FUNCTION IF EXISTS f', $link);
if (mysql_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25)
DETERMINISTIC RETURN ver_param;', $link)) {
$res = mysql_query('SELECT f(VERSION()) AS f_version', $link);
- var_dump(mysql_fetch_assoc($res));
+ $tmp = mysql_fetch_assoc($res);
+ if (!isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
+ printf("[012] Result seems wrong, dumping\n");
+ var_dump($tmp);
+ }
+ if (ini_get('unicode.semantics') && !is_unicode($tmp['f_version'])) {
+ printf("[013] Expecting unicode string, dumping\n");
+ var_dump($tmp);
+ }
mysql_free_result($res);
} else {
- printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link));
+ printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
}
@@ -71,14 +87,6 @@
["valid"]=>
string(30) "this is sql but with semicolon"
}
-array(1) {
- ["p_version"]=>
- string(%d) "%s"
-}
-array(1) {
- ["f_version"]=>
- string(%d) "%s"
-}
Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d
done!
@@ -87,14 +95,6 @@
[u"valid"]=>
unicode(30) "this is sql but with semicolon"
}
-array(1) {
- [u"p_version"]=>
- unicode(%d) "%s"
-}
-array(1) {
- [u"f_version"]=>
- unicode(%d) "%s"
-}
Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d
done!
| Thread |
|---|
| • PHP mysqlnd svn commit: r630 - trunk/tests/ext/mysql | uwendel | 4 Jul |