in reply to DBI - validate SQL without executing

security issues aside about running arbitrary strings from users, you could just do something like (you probably want some kind of injection-projection against ";commit" or something) just run it, check result/error, and rollback .. Assumes of course that the db supports transactions...
  • Comment on Re: DBI - validate SQL without executing

Replies are listed 'Best First'.
Re^2: DBI - validate SQL without executing
by Errto (Vicar) on Apr 10, 2006 at 17:57 UTC
    That is the approach that I was using, until someone pointed out that at least with some versions/database types of MySQL, that fails precisely because of the transaction issue. That was one motivator for my question; the other was that some of the statements can be significant resource hogs, so it would be better to hold off executing them until they're actually needed.