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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | _db_query_0.diff | 1.05 KB | killes@www.drop.org |
| #3 | _db_query.diff | 1.01 KB | Cvbge |
| database.mysql.inc.diff | 318 bytes | Cvbge |
Comments
Comment #1
Cvbge commentedI have moved the db_error part to http://drupal.org/node/25673
Comment #2
Cvbge commentedI forgot to make a patch for database.pgsql, but the change is the same.
Comment #3
Cvbge commentedPatch against current cvs, have both mysql and postgresql db. Maybe now someone will take a look at it?
Comment #4
killes@www.drop.org commentedThe patch makes sense to me. It shoudl have been rolled from the Drupal base directory, which I did.
Comment #5
dries commentedCommitted to HEAD. Thanks.
Comment #6
Cvbge commentedPlease also apply to 4.6, patch applies without problems.
Comment #7
dries commentedCommitted to DRUPAL-4-6. Thanks.
Comment #8
ken123 commentedComment #9
(not verified) commentedComment #10
(not verified) commentedComment #11
(not verified) commented