Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 749 times and has 2 replies Next Thread
Male karlmdavis
Novice



USA
Joined: Dec 15, 2007
Post Count: 39
Status: Offline
Reply to this Post  Reply with Quote 
"Unexpected token" in Query Generation

I'm using the 1.1.4 release of DataNucleus, running against an HSQL DB on Linux.

I'm getting the following error when:
DataNucleus.Datastore: java.sql.SQLException: Unexpected token: 12 in statement [SELECT 'phmpro.datasource.AbstractSensorValue ' AS NUCLEUS_TYPE FROM ABSTRACTSENSORVALUE A0 WHERE A0.PARENT_ASSET_ITEM_UUID_OID IS NULL AND A0.PARENT_ASSET_ITEM_SENSOR_PROPERTY_KEY IS NULL AND A0."TIMESTAMP" IS NULL AND A0.DISCRIMINATOR = 'phmpro.datasource.AbstractSensorValue' UNION SELECT 'phmpro.plugins.sensors.TemperatureSensorValue' AS NUCLEUS_TYPE FROM ABSTRACTSENSORVALUE A0 WHERE 'ff8081812237bd13012237bd45cb0005' = A0.PARENT_ASSET_ITEM_UUID_OID AND 'temp0' = A0.PARENT_ASSET_ITEM_SENSOR_PROPERTY_KEY AND 2009-07-01 12:14:14.226 = A0."TIMESTAMP" AND A0.DISCRIMINATOR = 'phmpro.plugins.sensors.TemperatureSensorValue']

This is thrown whenever I try to delete one of the TemperatureSensorValue instances. It looks like the generated query is not correctly quoting the timestamp field's value.

This looks simple enough that I could submit a patch for it myself but I can't figure out where the SQL for this gets generated. I've gotten as far as RDBMSStoreHelper but get lost after that. I was hoping someone could point me to where the SQLStatements and/or BooleanExpressions get converted to SQLTexts?

Thanks,
Karl
[Jul 1, 2009 9:34:23 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male karlmdavis
Novice



USA
Joined: Dec 15, 2007
Post Count: 39
Status: Offline
Reply to this Post  Reply with Quote 
Re: "Unexpected token" in Query Generation

Finally tracked it down. Looks like the conversion from a Java Timestamp to a String occurs in org.datanucleus.store.rdbms.sql.expression.TemporalLiteral.setStatement(). Unlike in StringLiteral, the converted String for TemporalLiteral is not escaped. I'll put together a short patch for this.
[Jul 2, 2009 12:36:47 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male karlmdavis
Novice



USA
Joined: Dec 15, 2007
Post Count: 39
Status: Offline
Reply to this Post  Reply with Quote 
Re: "Unexpected token" in Query Generation

I've opened a JIRA issue and attached a patch here:
http://www.jpox.org/servlet/jira/browse/NUCRDBMS-218

By the way, it's great to be able to build DataNucleus via Maven 2 now-- makes life much easier for us.
[Jul 2, 2009 10:53:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread