#1020 SQL: Fold on the 'AS' ... ; in `create view [name] as ... ;'


From Komodo bug http://bugs.activestate.com/show_bug.cgi?id=100627 :

The SQL editor only recognizes "CREATE TABLE tabelname ( ..." as a foldable section.

I'ld expect that a multi-line CREATE VIEW viewname AS ... ; also be recognized as a foldable section.

A little experiment show that the recognizer requires a '(' somewhere on the same line as
CREATE VIEW and a somewhere down a (balancing) closing ")" . That is not correct (may be allowable in some implementations, but certainly not all) SQL syntax.

Because VIEW, PROCEDURE, INDEX and TRIGGER statements can be quite large folding would be a very nice "summarizing" tool.

This patch implements that, and also makes sure each call to LexerSQL::Fold encompasses the line after the last ';' before startPos, and ends at the next ';' after the requested end-position, because find resolution is done on non-comment non-string ';'s.

1 Attachments


  • Neil Hodgson

    Neil Hodgson - 2013-09-25

    Using unsigned long for sql_state_t makes the size platform-dependent with it being 64-bit only on 64-bit Unix. Since its a bit mask and must work for 32-bits, having it sometimes be 64-bit has no benefit so more consistent to use an unsigned int which is always 32-bits.

    ....\scintilla\lexers\LexSQL.cxx(643): warning C4189: 'origEndPos' : local variable is initialized but not referenced [C:\u\hg\scite\win32\SciTE.vcxproj]

  • Eric Promislow

    Eric Promislow - 2013-09-25

    Revised patch.

  • Eric Promislow

    Eric Promislow - 2013-09-25

    Final (I hope) patch -- there was a mistake in a couple of the enum's, so I aligned
    the hex values to make it easier to pick out the differences.

  • Neil Hodgson

    Neil Hodgson - 2013-09-26
    • labels: --> scintilla, sql
    • assigned_to: Neil Hodgson
  • Neil Hodgson

    Neil Hodgson - 2013-10-15
    • status: open --> closed

Log in to post a comment.