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

killes drupal-devel at drupal.org
Sun Aug 7 17:07:26 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    database system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Cvbge
 Updated by:   killes at www.drop.org
-Status:       patch (code needs review)
+Status:       patch (ready to be committed)
 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.

killes at www.drop.org

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

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?

More information about the drupal-devel mailing list