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

Request #7671 Problem with autoExecute statement - missing grave accent
Submitted: 2006-05-19 12:47 UTC
From: steve at overlee dot com Assigned: lsmith
Status: Closed Package: MDB2 (version 1.7.6)
PHP Version: 4.4.2 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 7 - 4 = ?

 
 [2006-05-19 12:47 UTC] steve at overlee dot com (Steve Oliveira)
Description: ------------ When using autoExecute with mysql 5.0.18 I get the following syntax error: Error: INSERT INTO h_doors (name,type,handing,finish,manufacturer,condition,serial_no,comments,workorder_id,next_service,id) VALUES ('Door 1','Swing','LH Push','Clear','Hunter','Good','3weqwe','sdsa','3','2006-05-19',1) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition,serial_no,comments,workorder_id,next_service,id) VALUE] PHP CODE $database->autoExecute($this->table, $data, DB_AUTOQUERY_INSERT); autoExecute is not producing the correct syntax. It should surround the field names with grave accents (`)

Comments

 [2006-05-19 12:52 UTC] lsmith (Lukas Smith)
well for now the solution would be to quote the identifiers yourself. so this is a feature request and since DB is in maintaince mode I am changing this to an MDB2 issue. i will see if i can cook up a patch that can then be backported to DB.
 [2006-05-19 13:16 UTC] steve at overlee dot com
Is is possible to specify the quote identifier on autoExecute? If so how is this done? Or will have I have to do manual execute?
 [2006-05-19 13:18 UTC] lsmith (Lukas Smith)
No, you would have to manually quote the keys (which represent the identifiers) in your array using quoteIdentifier().
 [2006-05-19 16:26 UTC] danielc (Daniel Convissor)
You are using a reserved words for column names. That's a REALLY bad idea. DB will not be modified to allow users to shoot themselves in the foot like this. See the following text for good naming conventions and a list of reserved words. http://www.dbazine.com/db2/db2-disarticles/gulutzan5/view?searchterm=naming%20conventions
 [2006-05-20 10:34 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I have added support for identifier quoting. It will only be done if the quote_identifier option is enabled (default is disabled). http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Extended.php?r1=1.40&r2=1.41&diff_format=u