I need to check whether a SQL subexpression (to be used in WHERE
clause), e.g.:
colname > 200
or an entire SELECT statement, e.g.:
SELECT * FROM t1, t2 WHERE colname > 200
is syntactically valid. Is there a quick (and also safe) way to do this?
I'm thinking of doing "SELECT ... FROM ... WHERE <SQLexpr> LIMIT 0" for
#1, but I'm not sure if it's 100% safe; and I don't know what to do with
#2. AFAIK, in, say, Perl's DBI, $dbh->prepare() doesn't check SQL syntax
and $sth->execute() actually executes the statement.
--
dave