Re: EO & MySQL tedious error
Re: EO & MySQL tedious error
- Subject: Re: EO & MySQL tedious error
- From: Jonathan Rochkind <email@hidden>
- Date: Wed, 10 Sep 2003 10:09:43 -0500
I'm guesing your problem is that 'key' is a reserved word in MySQL, that's
why it needs to be surrounded by quotes?
Ideally, you'd change the name of that column, to not run into this. If you
can't do that though.... I think you can just define the 'external name'
of the attribute, in EOModeler, to have quotes around it. That is, instead of:
key
In EOModeler, the external name is:
"key"
With the quotes. That should do it for you, and EOModeler should use quotes
every time it generates SQL involving this attribute.
--Jonathan
At 11:44 AM 9/10/2003 +0200, Fabrice Truillot wrote:
Hi all.
Could someone please tell me how to force the EO SQL generator to surround
the column names by quotes ?
- My setup
Entity :
test_table
oid: int
key: varchar
I'm using MySQL 4.0.14, WebObjects 5.2.1 on MacOS X 10.2.6, all on the
same computer.
- Issue
I got this error :
Error:
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression
failed: : Next exception:SQL State:42000 -- error code: 1064 -- msg:
Syntax error or access violation, message from server: "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 'key = 'a')' at line 1"
Reason:
EvaluateExpression failed:
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "DELETE FROM
test_table WHERE (oid = ? AND key = ?)" withBindings: 1:2(oid),
2:"a"(key)>: Next exception:SQL State:42000 -- error code: 1064 --
msg: Syntax error or access violation, message from server: "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 'key = 'b')' at line 1"
MySQL doesn't like this SQL statement :
DELETE FROM test_table WHERE (oid = 2 AND key = 'a')
^^^
Actually, I don't have the possibility of renaming the key column. And
since DELETE FROM test_table WHERE (oid = 2 AND 'key' = 'a') works fine...
Any idea ? Thanks !
Fabrice Truillot, MiS $B%1%$AG$N?M(B
www.meninsilicium.com
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.