Home » Database » DB_DataObject » Bug #6534
Databse column in queries should be quoted in SQL statements
Details
| Request #6534 | Databse column in queries should be quoted in SQL statements |
|---|---|
| Submitted | 2006-01-20 00:05 UTC |
| From | dsouzae at hotmail dot com |
| Status | Bogus |
| Package | DB_DataObject |
| PHP Version | 5.1.1 |
| Roadmaps | (Not assigned) |
Comments
[2006-01-20 00:05 UTC] dsouzae at hotmail dot com
Description:
------------
I ran into problem where I had a column named 'change' in my MySQL server.
Example in test script section. This failed silently with the following error, the insert did not return an DBError object:
[db_error: message="DB Error: syntax error" code=-2 mode=return level=notice prefix="" info="INSERT INTO coverage_history (id , userid , field , change ) VALUES ( 1010 , 'edsouza' , 'status' , 'New' ) [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 'change ) VALUES ( 1010 , 'edsouza' , 'status' , 'New' )' at line 1]"]
I ended up changing the column name.
Test script:
---------------
INSERT INTO coverage_history (id , userid , field , change ) VALUES ( 1010 , 'edsouza' , 'status' , 'New' )
[2006-01-20 23:08 UTC] dsouzae at hotmail dot com
Thanks.
How come the insert method never returned an error?