• Login
Community
  • Login

Function List MariaDB Scrip

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 2 Posters 524 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    Aquim Elifá
    last edited by Apr 20, 2021, 3:39 PM

    Hi everyone, I’m lloking for some hel abut this topic, I developed a VBA application using MariaDB database, now I’m updating the database structure because i change some vba code, I’m using notepad++ to write de sql scrip, and Iwould like to have the list functions of my scrip, but the sql function list of notepad++ only showme a part of my function and Sp.
    Someome could help me, what I have to do?, I don’t know nothing about regular expression . Thans for your help.alt text

    P 1 Reply Last reply Apr 20, 2021, 4:37 PM Reply Quote 0
    • P
      PeterJones @Aquim Elifá
      last edited by Apr 20, 2021, 4:37 PM

      @Aquim-Elifá ,

      I see the same thing.

      It looks like the ([\s]*([ia]s)) alternative is hitting, and matching on i or a followed by s, which hits at the “is” in each of those function names. I don’t know why an SQL function-name parser would want that.

      I changed those to be \w+ instead of [ia]s , and at least for my example, it worked.

      But since I don’t SQL very well, I don’t know if that would break anything.

      To implement this:

      1. Exit Notepad++
      2. Edit %AppData%\Notepad++\functionList\sql.xml, and make it look like:
      <NotepadPlus>
      	<functionList>
      		<!-- ========================================================= [ PL/SQL ] -->
      		<parser id="plsql_function" displayName="PL/SQL" commentExpr="((/\*.*?\*)/|(//.*?$))">
      				<function
      				mainExpr="((PROCEDURE)|(FUNCTION))[\s]+[A-Za-z][\w_]*([\s]*\([^\)]*\)[\s]*)?(([\s]*;)|([\s]*(\w+))|([\s]+(RETURN)([\s]+[\w%\.]+)+(([\s]*;)|([\s]+(\w+)))))"
      				displayMode="$className->$functionName"
      			>
      				<functionName>
      					<nameExpr expr="[\s]+[A-Za-z][\w_]*([\s]*\([^\)]*\))?(([\s]*;)|([\s]*(\w+))|([\s]+(RETURN)([\s]+[\w%\.]+)+(([\s]*;)|([\s]+(\w+)))))"/>
      					<nameExpr expr="[A-Za-z][\w_]*([\s]*\([^\)]*\))?(([\s]*;)|([\s]*(\w+))|([\s]+(RETURN)([\s]+[\w%\.]+)+(([\s]*;)|([\s]+(\w+)))))"/>
      					<nameExpr expr="[A-Za-z][\w_]*([\s]*\([^\)]*\))?(([\s]+(RETURN)([\s]+[\w%\.]+)+))*"/>
      				</functionName>
      			</function>
      		</parser>
      	</functionList>
      </NotepadPlus>
      
      1. Save and exit
      2. Load your SQL file in Notepad++

      (Personally, I think the expressions they use could use some cleanup; a lot of parens that aren’t doing anything, and made it hard for me to figure out even as much as I did. )

      You also might want to look at @MAPJe71’s repo which includes functionList XML files for bunches of languages – if there’s an SQL in that repo, it might work better than yours. https://github.com/MAPJe71/Languages (I am seeing a parameter-completion file, but not any functionList file, unfortunately).

      A 1 Reply Last reply Apr 20, 2021, 5:19 PM Reply Quote 1
      • A
        Aquim Elifá @PeterJones
        last edited by Apr 20, 2021, 5:19 PM

        @PeterJones I was changing those code, but I did on C:\programs files, I changed the code using www.regex.com , and the code works, I leave the code and the pict as how I wanted. Thanks so much, and Excuseme by my english skill…, alt text```
        <functionList>
        <!-- ===== [ PL/SQL ] -->
        <parser id=“plsql_function” displayName=“PL/SQL” commentExpr=“((/*.?*)/|(//.?$))”>
        <function
        mainExpr=“((CREATE PROCEDURE)|(CREATE FUNCTION))[\s]+[A-Za-z][\w_][\wfx]([\s]([^)]|([\s]+(RETURNS)))”
        displayMode=“$className->$functionName”
        >
        <functionName>
        <nameExpr expr=“[\s]+[A-Za-z][\w_][\wfx]([\s]([^)]|([\s]+(RETURNS)))”/>
        </functionName>
        </function>
        </parser>
        </functionList>

        P 1 Reply Last reply Apr 20, 2021, 5:34 PM Reply Quote 1
        • P
          PeterJones @Aquim Elifá
          last edited by Apr 20, 2021, 5:34 PM

          @Aquim-Elifá ,

          I know you found one that worked for you. But I found another couple places:

          • https://community.notepad-plus-plus.org/post/22441 => shows a different take from four years ago
          • https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3741 => this is the pull request that made the distributed functionList\sql.xml as it is today, I think (the PR source has the [ia]s pieces)… but @MAPJe71 had chimed in with an alternative syntax which looks like it has a lot more features (plus comments!)… and when I tried that on my mockup of your example data, it worked for me. And I trust one of @MAPJe71’s solutions to have at least considered edge cases
          A 1 Reply Last reply Apr 20, 2021, 5:53 PM Reply Quote 0
          • A
            Aquim Elifá @PeterJones
            last edited by Apr 20, 2021, 5:53 PM

            @PeterJones Did you use @MAPJe71 code?, I going to test rigth now, it’s the result, its show the IF sentenses and some code where be in comment.
            I going to use the code that I changed, because I need only Functions and Store procedure, and I ever use the _fx() for Functions and _sp for Store Procedure.
            sincerely. I’m very greatifull for your help.

            1 Reply Last reply Reply Quote 0
            • A
              Aquim Elifá
              last edited by Apr 20, 2021, 5:55 PM

              I forget to add how the image looks 3.jpg

              1 Reply Last reply Reply Quote 0
              6 out of 6
              • First post
                6/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors