tmlab / tmql

Automatically exported from code.google.com/p/tmql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output of getNonParametrizedQueryString wrong

GoogleCodeExporter opened this issue · comments

Example:

updateCharacteristicStm = provider.createPreparedStatement("UPDATE 
characteristics SET ? WHERE ? << id");

String val = "City";
String id = "3074820921864052268";

updateCharacteristicStm.setString(0, val);
updateCharacteristicStm.setString(1, id);

System.out.println(updateCharacteristicStm.getNonParametrizedQueryString());

Output:
UPDATE characteristics SET Cityliner WHERE 3074820921864052268 << id

Expected Output:
UPDATE characteristics SET "Cityliner" WHERE "3074820921864052268" << id

Funny fact, executing:
UPDATE characteristics SET "Cityliner" WHERE 3074820921864052268 << id

works.. why?

Original issue reported on code.google.com by h.niederhausen@googlemail.com on 17 Feb 2011 at 6:11

It looks like, that the prepared statement only use the toString method of each 
given construct.

It is not a funny fact, that the thrid query works. The provided id of a topic 
map construct can be a long or a string value, depends on the underlying topic 
maps engine, e.g. MaJorToM supports ids as string and long. The tmql4j engine 
try to fetch a construct by its id using a string or long value.

Original comment by Sven.Kro...@googlemail.com on 18 Feb 2011 at 6:05

Original comment by Sven.Kro...@googlemail.com on 18 Feb 2011 at 6:06

  • Changed state: Started
The strings parameters will be transformed correctly.

e.g. ? << id

1) param = "Hans"       --> "Hans" << id
2) param = "Hans\""     --> """Hans\"""" << id
3) param = "Hans\"\"\"" --> """Hans\\\"\\\"\\\"""" << id

Original comment by Sven.Kro...@googlemail.com on 18 Feb 2011 at 6:40

  • Changed state: Fixed