I'm a bit confused about the purpose of the processEscapes() method.
It is used to process parameters for stored procedure calls, where the parameter is a pattern string. It seems to be replacing escape sequences such as '\x' with the unescaped character (or rather the alternate escape sequence '[x]'). Is this behaviour defined anywhere?
I spent a while trying to figure out what was going wrong with my code, which was basically this:
This has nothing to do with processEscapes(), it is just part of the nature of Java's String implementation; "foo\\bar" is processed as a single backslash. If you want two backslashes, you need to say "\\\\".
See this repl.it for example. You will need to do pre-processing on the string to make sure it has the desired number of backslashes - if you cannot know in advance how many are needed, try parameterizing the whole thing and constructing it with the correct number of backslashes dynamically (e.g., using the char code).
Last edit: Joey Smith 2016-05-31
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm a bit confused about the purpose of the processEscapes() method.
It is used to process parameters for stored procedure calls, where the parameter is a pattern string. It seems to be replacing escape sequences such as '\x' with the unescaped character (or rather the alternate escape sequence '[x]'). Is this behaviour defined anywhere?
I spent a while trying to figure out what was going wrong with my code, which was basically this:
The ResultSet returned was empty, even though the table exists in the specified schema. I had to change my schema string to get it to work:
The only information I could find about how a pattern string should be formatted is from the Java API which says:
Thanks,
Steve
Are there any news? I have the same problem with backslash in my schema name.
But I cannot write four backslashes.
Regards,
Alois
This has nothing to do with processEscapes(), it is just part of the nature of Java's String implementation; "foo\\bar" is processed as a single backslash. If you want two backslashes, you need to say "\\\\".
See this repl.it for example. You will need to do pre-processing on the string to make sure it has the desired number of backslashes - if you cannot know in advance how many are needed, try parameterizing the whole thing and constructing it with the correct number of backslashes dynamically (e.g., using the char code).
Last edit: Joey Smith 2016-05-31