views:

27

answers:

3

Hi all,

we're currently setting up out integration server and during that process we've set up pre-commit hooks on the SVN so that our developers can't check in files that are syntactically invalid (primarily PHP and XML).

We also have a bunch of .sql files (for MySQL) which I'd like to lint as well. Unfortunately, Google didn't turn up anything useful for this task.

Any ideas?

A: 

mysqltest ?

dvhh
I'm sorry, exactly how is mysqltest gonna help me? I didn't find anything in the docs that could be useful.
n3rd
A: 

Here is a validator, which validates against SQL 92/99/2003 standards however the fact you mention MySQL leads me to believe you are using MySQL specific syntax in your SQL queries.

One option is move to an agnostic approach in dealing with your database layer, writing agnostic SQL code. You will obviously need to get in contact with Mimer to see if you can take it offline and integrate it within your CI environment.

Couple of "ifs" in the overall approach and this is all contingent on the fact you are willing/able in the current state to write agnostic SQL code.

Aaron
Intersting link! Unfortunately, writing agnostic SQL is not an option. Out system has a lot of traffic and we need to squeeze every last bit of performance out of MySQL (in some places, at least).
n3rd
+1  A: 

The commercial version of MySQL Workbench has a syntax checker for MySQL statements, but of course that would only cover the database aspects. See http://mysql.com/products/workbench/ (though I found the factoid in the help index for the free app).

Richard Careaga
Thanks! But unfortunately I don't think I can talk my boss into buying that just for having another neat toy for our integration server :)
n3rd