Naming conflict: Don't use "target" !!

Permalink
I was working on a custom block today and wasted a lot of time trying to figure out why every time I saved some edits to an instance of the block I got a blank page with a JSON string at the top. (like this: {"aID":"11","arHandle":"Main","cID":"1","error":false,"bID":"169"}) The database was getting updated correctly each time, though.

It turned out to be caused by the fact that I had named a column in my block's table "target". It's all fine now, but it makes me wonder if there are any more potential naming conflicts ready to bite???

It's pretty easy to test this, just take the basic_test block and change the name of the "content" column to "target", then install, add an instance to a page and try to save.

agedman
 
Mnkras replied on at Permalink Reply
Mnkras
there are a few but its no c5, its mysql,

like rows, and columns ya cant use those either
jaredquinn replied on at Permalink Reply
jaredquinn
Probably should avoid 'group' and 'order' too.
agedman replied on at Permalink Reply
agedman
Thanks, Mnkras and jaredquinn! I will watch out for these and check the mysql docs!
andrew replied on at Permalink Best Answer Reply
andrew
Hmm. I don't think this is an issue with MySQL. I think this is an issue with the jQuery Form library. We use JavaScript to submit the form to the backend and then update the block on the front-end. The form library is responsible for serializing this information and submitting it - but sometimes the JavaScript can fail (if the form is malformed, etc..). We're trying to make it more graceful when this happens in 5.4.1, but I think the problem is that the form gets submitted, the form library sees "target" and tries to do something special with that, and fails. JavaScript fails completely then, and you see a response that you're not meant to see.
andrew replied on at Permalink Reply
andrew
What browser was this in?
agedman replied on at Permalink Reply
agedman
Firefox 3.6.4
ScottC replied on at Permalink Reply
ScottC
thanks for posting this, and trusting Mike's post one should always cross reference field names to mysql reserved keywords, in concrete5 development or not.