In some code, I am trying to construct a new StringValue, eg
StringValue sv = new StringValue("abcd");
When I write out the results (via SelectDeparser or just looking at the value returned from sv.getValue() or sv.getNonEscapedValue() the first and last letters are missing. Is this thing parsing a string literal? That is, do I need to include single or double quote characters, in addition to the string, eg
StringValue sv = new StringValue("'abcd'");
This works, but I want to know if it is on purpose or if I am not understanding it as it doesn't quite make sense to me.
thanks,
Patrick
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In some code, I am trying to construct a new StringValue, eg
StringValue sv = new StringValue("abcd");
When I write out the results (via SelectDeparser or just looking at the value returned from sv.getValue() or sv.getNonEscapedValue() the first and last letters are missing. Is this thing parsing a string literal? That is, do I need to include single or double quote characters, in addition to the string, eg
StringValue sv = new StringValue("'abcd'");
This works, but I want to know if it is on purpose or if I am not understanding it as it doesn't quite make sense to me.
thanks,
Patrick
Yes, that's how is supposed to work: the parser calls the constructor with the "escapedValue":
public StringValue(String escapedValue)
so it calls it with, say, "'mystring'"