Fix mysqli_stmt_attr_set in libmysql mode.

mysql_stmt_attr_set returns my_bool instead of int.
If it was int, then 0 is success and !0 is failure, but
for my_bool 0 (FALSE) is failure and !0 is success.
This commit is contained in:
Andrey Hristov 2009-09-25 12:25:54 +00:00
parent 07757b4f2f
commit 089e8b56a1
2 changed files with 3 additions and 3 deletions

View File

@ -2190,7 +2190,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
mode = mode_in;
#if !defined(MYSQLI_USE_MYSQLND)
if (mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) {
if (FALSE == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) {
#else
if (FAIL == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) {
#endif

View File

@ -58,7 +58,7 @@ require_once('skipifconnectfailure.inc');
do {
$invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX);
} while (in_array($invalid_attr, $valid_attr));
if (true !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0)))
/* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */
printf("[006b] Expecting boolean/true for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
}
@ -265,4 +265,4 @@ require_once('skipifconnectfailure.inc');
require_once("clean_table.inc");
?>
--EXPECTF--
done!
done!