]> granicus.if.org Git - php/commitdiff
Fix the 4.0 tree (forgot to commit)
authorZeev Suraski <zeev@php.net>
Mon, 6 Sep 1999 05:21:45 +0000 (05:21 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 6 Sep 1999 05:21:45 +0000 (05:21 +0000)
ext/mysql/php_mysql.c

index 436b1bd871c8643465f587d02407d3c7b2c13535..e3a2326fcea2c3d88838fd176fd434d2d839286a 100644 (file)
@@ -85,6 +85,9 @@ static int le_result,le_link,le_plink;
 #define MYSQL_NUM              1<<1
 #define MYSQL_BOTH             (MYSQL_ASSOC|MYSQL_NUM)
 
+#define PHP_MYSQL_VALID_RESULT(mysql)          \
+       (mysql_num_fields(mysql)>0)
+
 function_entry mysql_functions[] = {
        PHP_FE(mysql_connect,                                                           NULL)
        PHP_FE(mysql_pconnect,                                                          NULL)
@@ -822,7 +825,7 @@ PHP_FUNCTION(mysql_query)
        }
 #endif
        if ((mysql_result=mysql_store_result(mysql))==NULL) {
-               if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+               if (PHP_MYSQL_VALID_RESULT(mysql)) { /* query should have returned rows */
                        php_error(E_WARNING, "MySQL:  Unable to save result set");
                        RETURN_FALSE;
                } else {
@@ -883,7 +886,7 @@ PHP_FUNCTION(mysql_db_query)
        }
 #endif
        if ((mysql_result=mysql_store_result(mysql))==NULL) {
-               if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+               if (PHP_MYSQL_VALID_RESULT(mysql)) { /* query should have returned rows */
                        php_error(E_WARNING, "MySQL:  Unable to save result set");
                        RETURN_FALSE;
                } else {