[PHP-DEV] cvs: /php3 ChangeLog /php3/functions mysql.c From: Zeev Suraski (zeev <email protected>)
Date: 09/03/99

zeev Fri Sep 3 19:24:28 1999 EDT

  Modified files:
    /php3 ChangeLog
    /php3/functions mysql.c
  Log:
  - Return false from mysql_query() and mysql_db_query() in case saving the
    result set data fails
  
  
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.752 php3/ChangeLog:1.753
--- php3/ChangeLog:1.752 Fri Sep 3 14:42:34 1999
+++ php3/ChangeLog Fri Sep 3 19:24:27 1999
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 ???? ??, 1999, Version 3.0.13
+- Return false from mysql_query() and mysql_db_query() in case saving the
+ result set data fails (Zeev)
 - Make --with-apache --with-xml pick up Apache-bundled expat lib
 - Carry special Apache CFLAGS into PHP build for apxs build
   This should fix any PHP/mod_ssl compile issues (Rasmus)
Index: php3/functions/mysql.c
diff -u php3/functions/mysql.c:1.186 php3/functions/mysql.c:1.187
--- php3/functions/mysql.c:1.186 Sun Jul 4 13:30:42 1999
+++ php3/functions/mysql.c Fri Sep 3 19:24:27 1999
@@ -27,7 +27,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: mysql.c,v 1.186 1999/07/04 17:30:42 eschmid Exp $ */
+/* $Id: mysql.c,v 1.187 1999/09/03 23:24:27 zeev Exp $ */
 
 
 /* TODO:
@@ -881,10 +881,12 @@
         }
 #endif
         if ((mysql_result=mysql_store_result(mysql))==NULL) {
- /*php3_error(E_WARNING,"Unable to save MySQL query result");
- RETURN_FALSE;
- */
- RETURN_TRUE;
+ if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+ php3_error(E_WARNING, "MySQL: Unable to save result set");
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ }
         }
         return_value->value.lval = php3_list_insert(mysql_result,MySQL_GLOBAL(php3_mysql_module).le_result);
         return_value->type = IS_LONG;
@@ -946,11 +948,12 @@
         }
 #endif
         if ((mysql_result=mysql_store_result(mysql))==NULL) {
- /*
- php3_error(E_WARNING,"Unable to save MySQL query result");
- RETURN_FALSE;
- */
- RETURN_TRUE;
+ if (mysql_num_fields(mysql_result)>0) { /* query should have returned rows */
+ php3_error(E_WARNING, "MySQL: Unable to save result set");
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ }
         }
         return_value->value.lval = php3_list_insert(mysql_result,MySQL_GLOBAL(php3_mysql_module).le_result);
         return_value->type = IS_LONG;

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>