Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
database system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2007 at 03:06 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedThat's with MySQL 4.1, btw
Comment #2
yched commentedActually I think it's a bug.
It does not match the function description, and I don't think the pgsql equivalent behaves the same (it uses a "WHERE name = $tablename" style construct.
Attached patch checks if the provided name is empty and returns 0. (usual PHP 'empty' stuff : it will also reject '0', which I think is not a valid table name anyway - could be fixed, but I did not want to add too much cruft)
It do not think this is baby sitting broken code either :
cannot be considered broken code IMO, and should be considered 'the right way'
Comment #3
bdragon commentedHow about this?
Comment #4
drummIf you want to return FALSE, then return that and not the number 0.
Comment #5
kbahey commentedHere is a patch to mysql, mysqli, and pgsql.
It checks that $table is indeed passed in, and if so, it executes the query, otherwise it returns FALSE;
Comment #6
keith.smith commentedpatch no longer applies
# patch -p0 < db_table_exists_1.patch
patching file includes/database.mysqli.inc
Hunk #1 FAILED at 398.
1 out of 1 hunk FAILED -- saving rejects to file includes/database.mysqli.inc.rej
patching file includes/database.mysql.inc
Hunk #1 FAILED at 418.
1 out of 1 hunk FAILED -- saving rejects to file includes/database.mysql.inc.rej
patching file includes/database.pgsql.inc
Hunk #1 FAILED at 391.
1 out of 1 hunk FAILED -- saving rejects to file includes/database.pgsql.inc.rej
Comment #7
dpearcefl commentedIs there any interest or a need for this this be fixed?