← Back to team overview

maria-developers team mailing list archive

Re: Feature request: Add support for a syntax check for SQL scripts

 

Hi, Raphael!

On Oct 13, Raphael Vullriede wrote:
> 
> For that it would be great to have a feature that checks the script
> against a given database without actually executing it. It should not
> only check the SQL syntax but also if all mentioned tables, columns
> etc.  exists in the given database.
> 
> I'm thinking of something like this:
> 
> SET DISABLE_EXECUTION="TRUE";
> 
> -- here come the sql statements
> 
> SET DISABLE_EXECUTION="FALSE";

You will get a similar effect (not exactly the same, but close)
by wrapping your sql statements in 

  CREATE PROCEDURE ... BEGIN

  END
  DROP PROCEDURE

your sql wil be parsed, the server will check all mentioned tables,
columns, etc. But nothing will be executed.

> I've tried to write such a check with an external tool but as it turned
> out this is virtually impossible and has a lot of loopholes.

External tool is possible too.
Looks at perl modules DBIx::MyParse and DBIx::MyParsePP.

Regards,
Sergei


Follow ups

References