Announcement

Collapse
No announcement yet.

SQL editor

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

  • 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.

  • #2
    WinSQL does comments by using a double-dash ( "--") at the start of the line. You could stea... er, 'adapt' that idea.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I guess that depens on which characters the DBMS uses as a comment notifier.

      Comment


      • #4
        > 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!
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          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.

          Comment


          • #6
            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]
            Paul Squires
            FireFly Visual Designer (for PowerBASIC Windows 10+)
            Version 3 now available.
            http://www.planetsquires.com

            Comment


            • #7
              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?

              Comment


              • #8
                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

                Comment

                Working...
                X