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: Thu, 01 Nov 2001 23:40:29 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

address@hidden (Mickey Ferguson) writes:

> From what I was told, and then going from memory on top of that, the
> backslash is an escape character for error handling sections, for things
> like \n to produce a newline, stuff like that.  But it's a perfectly valid
> character inside a string.

> I looked at the date/time of sql.el, found in the lisp/progmodes folder, and
> it is Jun 16  1999, and inside the file it says it is version 1.4.5.  Is
> this problem fixed in a newer version?

No, this has not been fixed.  The problem is that when I personally
write SQL, I practically never use backslashes -- unless I have told
the DB explicitly that the backslash shall be used as an escape
character.

If you use C-u C-x = on the escape character in SQL mode, you'll get a
buffer like this:

  character: \ (0134, 92, 0x5c)
      ...
     syntax: escape
      ...

The syntax class is "escape".  The simplest solution would be to make
the backslash never escape -- to make it a normal punctuation
character, in fact.  The complex solution would be to correctly parse
SQL, which I think is overkill.

The simplest solution requires you to put the following in your
~/.emacs file:

(require 'sql)
(add-hook 'sql-mode-hook
          (lambda ()
            (modify-syntax-entry ?\\ "." sql-mode-syntax-table)))

Once you do this, a SQL buffer with the following statement correctly
ends the string at the second apostrophe:

     select 'foo\' from foo;

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



reply via email to

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