RE: variables prefix - ?variable vs. $variable

On Tue, 31 Aug 2004, Seaborne, Andy wrote:

> So are you saying ALL '?' get processed, even if in a literal?

We've found several JDBC interfaces where this is downright buggy; and
where an escape of a ? which is followed by something which happened to be
a ?validvarname is handled incorrectly.

I.e. {escape 'escape-character'} does not work for some inside a literal.

> How does a client ask query that involves a ? in a string?

Use an escape sequence; such as \.

BUT these are often trapped by, say, the java compiler. So you end up
having to use, say, a more harmless / and end up with:

statement.executeQuery(
  "SELECT * FROM FACT WHERE
	DESC='Dirkx/'s opinion is that escaping sucks too ' {escape '/'}");

statement.executeQuery(
  "SELECT ?x FROM FACT WHERE
	DESC='Where are the pigeons/?' { escape '/'}");

Which gets downright horrible if you need a ", { or ' also in
your query string in a langauge where they also have a special
meaning. (And pray that % and  _ which are special in LIKE
are not part of it - but luckily most DB's allow for the { escape } to
be used multiple times in the same string).

Hence; lets avoid the ? and use a '^', '@', '+' or something harmelss.

Dw.

Received on Tuesday, 31 August 2004 12:56:51 UTC