Announcement

Collapse
No announcement yet.

SQL editor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • E Dingsor
    replied
    Stripping out comments from SQL statement

    Hi,
    Here's a sub that I use for stripping out comments from SQL statements before executing the SQL call.


    Eigil

    '-----------------------------------------------------------------
    'Removes comments of syntax /* .............*/ from a string. Works with 'multiline comments.
    '----------------------------------------------------------------
    SUB RemoveComments(instring AS STRING)
    LOCAL sMain,sSrc,sMask ,sTmp,sRepl AS STRING
    LOCAL lPos AS LONG
    sSrc = instring
    sMask = "/\*[^\*/]+\*/" 'searching mask
    sRepl= ""
    DO
    REGREPL sMask IN sSrc WITH sRepl AT lpos TO lpos, sTmp

    sSrc = sTmp
    LOOP WHILE lPos
    instring =sTmp
    END SUB

    Leave a comment:


  • Chris Holbrook
    replied
    Paul, thanks for your kind offer. I will defer response, if I may, until I have reached the point of exhaustion with EDM32.

    One thing I need to do with the editor is to select data from other controls and insert it into the editor at caret position, without using the clipboard. My guess is that yours does this too?

    Leave a comment:


  • Paul Squires
    replied
    Multiline comments using Borje's EDM32 is not easy to do - that's one of the reasons why I ended up writing my own code editing component from scratch (that and code folding).

    I can't give you the source code, but if you would like to use the component (which helps me in the testing of it!), you can email me at [email protected]

    Leave a comment:


  • Chris Holbrook
    replied
    Originally posted by Knuth Konrad View Post
    I guess that depens on which characters the DBMS uses as a comment notifier.
    I'm expecting to use it with SQLite, which does single-line and multiline comments, -- and /*...*/ respectively. The original code can easily be adapted to do single-line comments.

    Leave a comment:


  • Michael Mattias
    replied
    > I guess that depens on which characters the DBMS uses as a comment notifier

    No, no. no... You strip out the comments BEFORE you pass the rest of the statement to the DBMS!

    Leave a comment:


  • Knuth Konrad
    replied
    I guess that depens on which characters the DBMS uses as a comment notifier.

    Leave a comment:


  • Michael Mattias
    replied
    WinSQL does comments by using a double-dash ( "--") at the start of the line. You could stea... er, 'adapt' that idea.

    Leave a comment:


  • Chris Holbrook
    started a topic SQL editor

    SQL editor

    Just made a version of Borje Hagsten's EDM32.inc to do SQL editing, if of interest let me know & I'll post it. It's not sophisticated, just highlights keywords (SQLite, easy to change a data statement) and literals, as I have not yet worked out how to do comments.
Working...
X