Building A SQL Operations Studio Extension

Drew Furgiuele is building a bridge to nowhere in SQL Operations Studio:

So when I sat down to write noWHERE, the concept seemed simple enough: I’ll code some text parsing into extension.js to look at the editor window’s text and look for UPDATE and DELETE statements and then try to see if there’s a missing WHERE clause. Seems reasonable enough, right? Except writing a SQL parser isn’t really something I want to do (or would be ABLE to do, frankly).

Since the module is written in JavaScript, I can leverage node.js modules to do most of the work for me. In this case, I downloaded a module called sqlite-parser. It’s a barebones, no-frills SQL syntax parser. It doesn’t support any dialect-specific stuff for T-SQL, but for this initial project, I only really care about ANSI UPDATE and DELETE statements.

There’s also a T-SQL parser available via Powershell, though I suppose that one isn’t directly available within SqlOps.  One thing that would make this really good would be to intercept the execute operation and pop up a warning dialog if there’s no WHERE clause.  There are some third-party tools which do this for Management Studio and a gate like that really saves you in the event of an emergency.

Related Posts

SQL Operations Studio May Release

Alan Yu announces the latest release of SQL Operations Studio: Highlights for this build include the following. Announcing Redgate SQL Search extension available in Extension Manager Community Localization available for 10 languages: German, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Simplified Chinese and Traditional Chinese! GDPR-compliant build has reduced telemetry collection, improved opt-out experience and in-product links to Privacy Statement Extension Manager […]

Read More

SQL Operations Studio April Release

Alan Yu announces the April release of SQL Operations Studio: Highlights for this build include the following. Public preview release of SQL Agent extension Added new extensions and improved existing extensions Improvements to Server Reports Extension Release of SSMS Keymap extension Release of AlwaysOn Insights extension Release of MSSQL Instance Insights Release of MSSQL Db […]

Read More

Categories

March 2018
MTWTFSS
« Feb Apr »
 1234
567891011
12131415161718
19202122232425
262728293031