SQLAnywhere specific issue (hardly a bug)

  • David

    David - 2009-07-30

    NOTEPAD++ Version 5.4.5

    Sybase SQLAnywhere supports two IF statement formats for different purposes

    IF ...  THEN ... ELSE ... END IF;
                    (note space in END IF  - as a conditional executable statement - common)
    IF ... THEN ... ELSE ... ENDIF 
                   (note no space in ENDIF - internal within a SQL statement (probable extension))
    in the following context
    UPDATE {table}
           SET {col}  = IF {col2} = 'A' THEN 1 ELSE 0 ENDIF,
                   (col3} = IF {col4} = 'B' THEN 1 ELSE 0 ENDIF;

    Adding ENDIF to the other SQL reserve words is not an issue, I understand the Styler Configurator.

    However the new outline expansion contraction mechanism the boxed + and - get confused  as they do not appear to be recognizing ENDIF similarly to END IF.  Currently this is an annoyance when the above two items in the set statement are construed as cascading IFs instead of non-cascading IFs.  I'm not sure if it will become a greater problem as I make other uses of the available syntax extension.

    Can ENDIF be added as equal to END IF in the SQL syntax for the opening and closing of IF statements?  This should not be terribly adverse to non-SQL Anywhere users as their SQL engines will catch the missing space when statements are executed.  This could also be made optional (configurable) however I am not sure that is necessary given that the target SQL engine will object to ENDIF (if inappropriate) when the command is executed and the fact that inclusion of ENDIF in the Styler Configurator could and should remain a user option.

    Thanks for considering this in advance.

    It appears from the .XML file and Styler Configurator you already support the ELSEIF in place of ELSE in SQL IF statements (I have not tested this).

    • David

      David - 2009-08-01

      I now recognize this as a folding (scintilla) issue and I am also attempting to work with them to change the behavior.