SQL folding

25 views
Skip to first unread message

pasha19

unread,
Oct 23, 2009, 9:46:24 AM10/23/09
to scintilla-interest
SQL Anywhere for one supports the following construct (ENDIF without
space)
IF {condition} THEN {value} ELSE{IF {condition}} {value} ENDIF

Usage example

UPDATE {table}
SET {col} = IF {condition} THEN
{value}
ELSE{IF {condition}}
{value}
ENDIF,
{coln} = {colx};

in addition to the standard (END IF with space)
IF {condition} THEN {statement(s)} ELSE{IF {condition}} {statement(s)}
END IF;

Is it achievable within your current design for either ENDIF (without
space) AND END IF (with space) both be used to be the end of the fold
for an IF in SQL?

Philippe Lhoste

unread,
Oct 23, 2009, 11:17:29 AM10/23/09
to scintilla...@googlegroups.com
On 23/10/2009 15:46, pasha19 wrote:
> Is it achievable within your current design for either ENDIF (without
> space) AND END IF (with space) both be used to be the end of the fold
> for an IF in SQL?

I believe you have to do a little change to LexSQL.cxx and recompile Scintilla.
See the FoldSQLDoc function, look at strcmp(s, "end") call and around.

--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --

pasha19

unread,
Oct 23, 2009, 1:02:59 PM10/23/09
to scintilla-interest


On Oct 23, 11:17 am, Philippe Lhoste <Phi...@GMX.net> wrote:
>
> I believe you have to do a little change to LexSQL.cxx and recompile Scintilla.
> See the FoldSQLDoc function, look at strcmp(s, "end") call and around.


Thanks for the prompt feedback.

In that I believe I utilize scintilla through the Notepad++
application would I need to learn to compile both or is it possible
this change could be incorporated into scintilla. I do not believe
supporting ENDIF (no space) will be a big issue for SQL databases that
do not support ENDIF no space. Or would creating a new lexSANY.cxx
adding a new menu option be the preferred approach to get this
incorporated into the base scintilla release?

Neil Hodgson

unread,
Oct 24, 2009, 2:26:11 AM10/24/09
to scintilla...@googlegroups.com
pasha19:

> In that I believe I utilize scintilla through the Notepad++
> application would I need to learn to compile both or is it possible
> this change could be incorporated into scintilla.  I do not believe
> supporting ENDIF (no space) will be a big issue for SQL databases that
> do not support ENDIF no space.  Or would creating a new lexSANY.cxx
> adding a new menu option be the preferred approach to get this
> incorporated into the base scintilla release?

Since it only triggers if endif is in the SCE_SQL_WORD style, the
application won't see any change unless endif is one of its keywrds.
Thus it is safe if you just add endif to the indicated clause.

Neil

pasha19

unread,
Oct 24, 2009, 6:09:01 AM10/24/09
to scintilla-interest
Thanks

pasha19

unread,
Oct 25, 2009, 1:22:04 PM10/25/09
to scintilla-interest


I have made the change and it works. I also removed the end test for
"exists" because SQL Anywhere uses exists as a function after an IF.

Thanks to all for the advice.
Reply all
Reply to author
Forward
0 new messages