tmlab / tmql

Automatically exported from code.google.com/p/tmql
1 stars 0 forks source link

Output of getNonParametrizedQueryString wrong #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
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