[drupal-devel] [bug] _db_query() does not return FALSE in case of errors, as stated in documentation

Cvbge drupal-devel at drupal.org
Thu Aug 11 15:01:37 UTC 2005


Issue status update for 
http://drupal.org/node/25522
Post a follow up: 
http://drupal.org/project/comments/add/25522

 Project:      Drupal
-Version:      cvs
+Version:      4.6.2
 Component:    database system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Cvbge
 Updated by:   Cvbge
-Status:       fixed
+Status:       patch (ready to be committed)

Please also apply to 4.6, patch applies without problems.




Cvbge



Previous comments:
------------------------------------------------------------------------

Wed, 22 Jun 2005 12:40:50 +0000 : Cvbge

Attachment: http://drupal.org/files/issues/database.mysql.inc.diff (318 bytes)

According to documentation db_query() should return FALSE "if the query
was not executed correctly". This function calls _db_query() which
returns nothing in such cases (for example when the sql syntax is
wrong).


Attached one-liner fixes this by adding return FALSE to _db_query().
It's from 4.6.1 but should apply to cvs without problems. Please apply
this patch also to 4.6 branch.


But there seems to be a problem with db_error(). It calls mysql_errno()
but it seems that errors are cleared after mysql_error() call. So
db_error() does not indicate any errors even if they occur.




------------------------------------------------------------------------

Fri, 24 Jun 2005 06:53:43 +0000 : Cvbge

I have moved the db_error part to http://drupal.org/node/25673




------------------------------------------------------------------------

Fri, 24 Jun 2005 07:00:03 +0000 : Cvbge

I forgot to make a patch for database.pgsql, but the change is the same.




------------------------------------------------------------------------

Sun, 07 Aug 2005 09:53:15 +0000 : Cvbge

Attachment: http://drupal.org/files/issues/_db_query.diff (1.01 KB)

Patch against current cvs, have both mysql and postgresql db. Maybe now
someone will take a look at it?




------------------------------------------------------------------------

Sun, 07 Aug 2005 17:07:25 +0000 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/_db_query_0.diff (1.05 KB)

The patch makes sense to me. It shoudl have been rolled from the Drupal
base directory, which I did.




------------------------------------------------------------------------

Thu, 11 Aug 2005 13:51:23 +0000 : Dries

Committed to HEAD.  Thanks.







More information about the drupal-devel mailing list