in reply to validating SQL using DBI

It works, but it prints the error twice, not sure why.

Turn off PrintError

Won't statements with placeholders (such as SELECT * FROM Table WHERE id = ?) result in a verdict of invalid? Your tool would tell me just about every statement I write is invalid. It discourages best practices.

You shouldn't use a variable for two different purposes. Use a different variable other than $sth to hold the result. There's no reason $sth should even exist outside the eval.

Replies are listed 'Best First'.
Re^2: validating SQL using DBI
by sflitman (Hermit) on Jun 29, 2009 at 02:02 UTC
    The tool will be used for validating static data definition statements, mostly CREATE TABLE statements. I did run into a problem with a file that was just a big COPY statement where it thought a time 17:30 was a :-placeholder, not sure how to handle that case.

    I thank you for the suggestion to set PrintError to 0, that of course did the trick! I updated the OP.

    SSF