Community
    • Login

    SQLinForm: new Usage Inspector finds unused variables in SQL

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    1 Posts 1 Posters 24 Views 1 Watching
    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.
    • Guido ThelenG Online
      Guido Thelen
      last edited by

      Hello, SQLinForm got another new function: the Usage Inspector. It sits right next to the Navigator I introduced a few weeks ago and answers a question I often had with inherited SQL: is this variable or column actually used anywhere, or is it dead code?

      demo_used.png

      What it does

      • Hover over any word: a pop-up shows how often it is used and every line where it appears, with a few lines of context.
      • Spot unused items quickly: a word that appears only once gets a red-orange header. A variable that is declared and never used stands out immediately.
      • Comments don’t count: a variable that is only mentioned in a comment still shows up as unused.
      • Strings are counted separately: a variable that is only used in dynamic SQL is not reported as dead, e.g. @CutoffDate inside EXEC sp_executesql.
      • Click to keep and jump: click the word to keep the pop-up open, then click a line to jump to it.
      • Your colors: the SQL is shown in the colors of your SQLinForm profile. Light and dark themes are both supported.
      • Everything is included: it reads the whole script, also parts the Navigator tree doesn’t show, such as DECLARE.

      demo_unused.png

      Like the Navigator, it needs no database connection and works with every dialect the formatter supports. It just counts words and does not parse or execute anything, so please treat the result as a hint, not a proof: SET @x = 1 counts as a use, for example.

      You can open it with the new magnifier button in the toolbar, or with the Usage Inspector tab next to Formatter and Navigator.

      As before, I appreciate any suggestion or error feedback :-)

      demo_dark.png

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors