Fix the 4.0 tree (forgot to commit)

This commit is contained in:
Zeev Suraski 1999-09-06 05:21:45 +00:00
parent cb25b1222e
commit f3e63d9e71

View 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 {