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!

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:

No comments:

Post a Comment