uw                                       Mon, 31 May 2010 12:10:04 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299983

Log:
Fixing mysqli_stmt_attr_set @ libmysql

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
    U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
    U   php/php-src/trunk/ext/mysqli/mysqli_api.c
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c        2010-05-31 
12:02:55 UTC (rev 299982)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c        2010-05-31 
12:10:04 UTC (rev 299983)
@@ -2219,7 +2219,7 @@

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

Modified: 
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt     
2010-05-31 12:02:55 UTC (rev 299982)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt     
2010-05-31 12:10:04 UTC (rev 299983)
@@ -45,18 +45,15 @@
                printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        $stmt->prepare("SELECT * FROM test");
-
+
        mt_srand(microtime(true));

-       /* mysqlnd detects invalid attributes, libmysql does not AFAIK */
-       $invalid_ret = ($IS_MYSQLND) ? false : true;
-
        for ($i = -100; $i < 1000; $i++) {
                if (in_array($i, $valid_attr))
                        continue;
                $invalid_attr = $i;
-               if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
-                       printf("[006a] Expecting boolean/%s for attribute %d, 
got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
+               if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
+                       printf("[006a] Expecting boolean/false for attribute 
%d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
                }
        }

@@ -64,8 +61,8 @@
                do {
                        $invalid_attr = mt_rand(-1 * (min(4294967296, 
PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
                } while (in_array($invalid_attr, $valid_attr));
-               if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
-                       printf("[006b] Expecting boolean/%s for attribute %d, 
got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
+               if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
+                       printf("[006b] Expecting boolean/false for attribute 
%d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
                }
        }
        $stmt->close();

Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c
===================================================================
--- php/php-src/trunk/ext/mysqli/mysqli_api.c   2010-05-31 12:02:55 UTC (rev 
299982)
+++ php/php-src/trunk/ext/mysqli/mysqli_api.c   2010-05-31 12:10:04 UTC (rev 
299983)
@@ -2219,7 +2219,7 @@

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

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt        
2010-05-31 12:02:55 UTC (rev 299982)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt        
2010-05-31 12:10:04 UTC (rev 299983)
@@ -45,18 +45,15 @@
                printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), 
$tmp);

        $stmt->prepare("SELECT * FROM test");
-
+
        mt_srand(microtime(true));

-       /* mysqlnd detects invalid attributes, libmysql does not AFAIK */
-       $invalid_ret = ($IS_MYSQLND) ? false : true;
-
        for ($i = -100; $i < 1000; $i++) {
                if (in_array($i, $valid_attr))
                        continue;
                $invalid_attr = $i;
-               if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
-                       printf("[006a] Expecting boolean/%s for attribute %d, 
got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
+               if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
+                       printf("[006a] Expecting boolean/false for attribute 
%d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
                }
        }

@@ -64,8 +61,8 @@
                do {
                        $invalid_attr = mt_rand(-1 * (min(4294967296, 
PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
                } while (in_array($invalid_attr, $valid_attr));
-               if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
-                       printf("[006b] Expecting boolean/%s for attribute %d, 
got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
+               if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 
$invalid_attr, 0))) {
+                       printf("[006b] Expecting boolean/false for attribute 
%d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
                }
        }
        $stmt->close();

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to