bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in SQL parsing?


From: Alex Schroeder
Subject: Re: Error in SQL parsing?
Date: Sun, 04 Nov 2001 21:59:04 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

"Stefan Monnier" <monnier+gnu.emacs.bug/news/@RUM.cs.yale.edu> writes:

>>>>>> "Alex" == Alex Schroeder <alex@gnu.org> writes:
>> What happens in Oracle is this: String delimiter is the apostrophe,
>> there is no escape character, and doubling the apostrophe inserts one.
> 
> OK.  So, for that case \ should not be an escape

RMS seems to think the same, so I will change this.

>> I sometimes use a feature of SQL*Plus, however, which allows me to
>> define an escape character (any character can be used!).  In order to
> 
> Yuck!
> 
> What's the "normal" case (i.e. the situation most common to people using
> sql-mode) ?

They don't use backslashes at all, so they never notice.  :)

> How do you tell SQL*Plus to use \ (or some other char) as an escape ?

escape \
...
...
...
select 'select 1 from dual where \&input like ''foo'';' from dual;
...
...
...

In the above case, there's no way to enter the string without escape
character, because it is a feature of SQL*Plus to interactively query
for the value of all occurences of &foo.  You cannot escape the
ampersand AFAIK except with an escape character.

> Should sql-mode just have a config var and do
> 
>    (defvar sql-escape-char nil)
> 
>    ...
>       (if sql-escape-char
>           (modify-syntax-entry sql-escape-char "\\" st))

This seems to be the wrong approach.

Consider this:

escape \
select '\&foo' from dual;
escape $
select '\$foo' from dual;
escape off

What would you want sql-mode to do?  I think the only way to deal with
this is a compromise:  Use the backslash as a default escape character
because many people assume this to be true, or use no escape character
and assume that people that need this will be able to modify the
syntax table.  I chose to use a sensible default, RMS seems to prefer
to go by the book.  Both are equally valid, I think.

Alex.
-- 
http://www.emacswiki.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]