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: Fri, 02 Nov 2001 18:29:33 +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:

> I don't know SQL (but am quite familiar with syntax-table related
> problems like the above ;-), so could anybody tell me really in what
> cases does \ escape the following character in SQL ?
> For \n, it's not important whether Emacs knows that the `n' is escaped
> (it usually treats an escaped char pretty much like a normal letter
> anyway).
> 
> Usually, the important cases where Emacs needs to know about
> escaping is when the escape char (i.e. \) can be used to insert
> a string delimiter inside a string (like "foo\"bar"), but
> if that never happens in SQL, then sql-mode should probably not
> set \ to "escape syntax".

What happens in Oracle is this: String delimiter is the apostrophe,
there is no escape character, and doubling the apostrophe inserts one.

Example:

select 'foo''bar' from dual;

=> foo'bar

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
keep my sanity, I obviously choose the backslash whenever I need to do
that.  This is my personal preference.  And it doesn't bite me because
in all other cases, I rarely use it.

Therefore, for me, backslash having the escape syntax is more often
right than wrong.  And writing code to do the right thing in all
situations (and for all vendors!) is a bad deal, IMHO: A trivial
feature but a big effort.

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



reply via email to

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