Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #43 Table names need quoting.
Submitted: 2003-09-28 22:13 UTC
From: jon at jellybob dot co dot uk Assigned: alan_k
Status: Closed Package: DB_DataObject
PHP Version: 4.3.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2003-12-13 06:16 UTC
Package:
Bug Type:
Summary:
From: jon at jellybob dot co dot uk
New email:
PHP Version: Package Version: OS:

 

 [2003-09-28 22:13 UTC] jon at jellybob dot co dot uk
Description: ------------ While trying to use a data object on a table named group (I also noticed that this table name is used in the docs), no records were retrieved despite there being records in the database. Once I set __table by hand to `group` instead of group, records were returned. Reproduce code: --------------- // Dataobject Definition [...snip...] ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ var $__table = 'group'; // table name var $id; // int(9) not_null primary_key auto_increment var $name; // string(32) not_null unique_key [...snip...] // Call $group = new Object_Group; $group->find(); while($group->fetch()) { echo $group->getName(); } Expected result: ---------------- The group names found would be displayed. Actual result: -------------- __find CONNECT NEW CONNECTION CONNECT mysql://[username]@localhost/[database] fc355c051919887a98657ea6e6602730 sql QUERYSELECT * FROM group SENT SELECT * FROM group ERROR DB Error: syntax error __find CHECK autofetchd __find DONE ERROR fetch: No Data Available STATIC GET - TRY CACHE Object_User 1 STATIC GET - NOT IN CACHE Object_User 1

Comments

 [2003-09-30 06:34 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-10-22 10:33 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-10-22 15:20 UTC] jon at jellybob dot co dot uk
I'm not sure why it's out of scope, don't you just need to quote the table name whenever you use it, since just wrapping it in `s will fix the problem.
 [2003-10-23 00:56 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-11-25 02:36 UTC] brian at OpenSourceConcepts dot com
Just thought I'd add my two cents here - I would definitely recommend quoting the table names. If you take all the keywords for all the databases supported, there are a lot of keywords (Postgres alone has a ton.) With the strict naming conventions of large and/or integrated apps (where the PHP developer might not own the data model) it seems a lot more robust to assume the worst and quote table names.
 [2003-12-10 21:49 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-12-10 22:00 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-12-11 17:29 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-12-12 01:39 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-12-13 06:16 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!