Wednesday, October 21, 2009

SQL Formatter Released!

Although, not finished by any stretch, I have released my first draft of the Laan.Sql.Formatter to 'production'.

I have provided 3 deliverables - each providing access to SQL Formatting for different purposes:
  • Sql Server Management Studio 2008 (SSMS) Plugin
  • Ad-hoc Sql Formatter Web Page
  • Sql Formatter Log4Net Appender (for use with NHibernate)
Further, the SSMS plugin provides a second feature - code template expansions. I've 'borrowed' the idea shamelessly from DevExpress' CodeRush (awesome tool), but without all the trappings. In my version, you can only expand a template that you know and remember (no visual clues - sorry, this *may* come some day), Also, the template list can't be edited/added/removed (yet).

For more information, and to obtain an installer for the plugin, go to the project site, or directly to the download page. There is also a download for the NHibernate Appender, with some simple documentation on it's use still to come. To play with the formatter, you can go to my web site as per my last blog entry.

If you find an issue, or have a feature request, you can add it here - but don't bother to log an issue regarding missing formatting options - I know I need to add some, eventually, but my plan is to get the core functionality done first.

Also, I would appreciate it if someone could provide a code review of my work so far. There is no doubt some of it needs more work, especially within the formatter assembly.. All code is available via svn hosted on google code, so it's easy to get access to a read only file set, or on the download page on the above link. If you are interested, let me know, or just send me an email of your review or blog it.

I hope you find these tools useful, I know I have..



Thursday, May 28, 2009

Laan SQL Formatter (alpha) is online!

Finally, after much wailing and nashing of teeth, I've delivered my first draft (alpha) of my SQL code formatter. There's not much too it, simply enter (or copy) your SQL into the top, hit convert, and the bottom will (should!) supply the formatted result!

code.laanfamily.com


Also, I will soon be releasing an NHibernate Appender which raps this functionality into a FormattedSqlFileAppender, once I get the appender subclassing working correctly.

Currently, the formatter (and even the parser, behind the scenes) is quite limited. It only supports SELECT statements, without UNION and SELECT..INTO modifiers. I believe there is full expression syntax parsing, but some aspects of expressions are still not formatted - e.g., bracketed sub expressions.

I will keep modifying it over time, as time permits (baby is now 6 weeks away!), but hopefully I can quickly implement INSERT, UPDATE and DELETE, CREATE TABLE and CREATE VIEW statements fairly rapidly. Then I'll work towards doing batched SQL instead of single statements, which will open the door for stored procedures.


Stay tuned!

P.S. Interested in the code? check it: http://code.google.com/p/sqlformat/