RE: variables prefix - ?variable vs. $variable

-------- Original Message --------
> From: Dirk-Willem van Gulik <>
> Date: 31 August 2004 13:57
> 
> 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.

This is a worrying argument - we can not hope to steer round bugs because
one system does it wrong and another does it right.  At this point we are
not reusing other systems - we are designing the syntax for them.  They may
get fixed (hopefully).

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

So - there is an escape mechanism.  (Aside: it was stated a while back there
wasn't).  We will have to use it somewhere for those characters in query
literals.  It is then independent of the query language and is specific to
the lcoal environment.

> 
> > 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 '/'}");

It's a common idiom that programmers are used to:

	DESC='Dirkx\\'s opinion is that escaping sucks too ' {escape
'\\'}");

It's a "feature" :-) of the coding language.

> 
> 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.

We can't proceed with this arbitrary way of deciding what's in and what's
out.  The same argument could be made for $.  That is a client-side
substituion marker (Perl and bash).

I'm happy for minor changes to avoid unnecessary inconvenience (so, for
example, $ for ? is OK by me at the moment but if $ gets used, its not).  It
is far, far too early to argue from inconsistent usage and some buggy
systems.  Do it when we are near the end-game as ways to increase useableity
but don't warp the whole design on it.

Thanks for clearing things up.

	Andy

> 
> Dw.

Received on Tuesday, 31 August 2004 14:10:11 UTC