Bonus points if you can figure out what might cause problems with this bit of sql:
Any guesses?
Perl's DBI (or perhaps Oracle's DBD) parses this sql properly. However, TOAD, TORA and Ruby's DBI do not. The problem, believe it or not, is the apostrophe when combined with a placeholder (although TORA seems to choke even with a hard coded value). It seems everything east of the apostrophe (inlcuding the apostrophe) is getting lumped together with the "select" clause.
I can't speak for TOAD, but the problem in Ruby's DBI lies in the simple lexer it uses to parse sql when placeholders are used. Shouldn't be too hard to fix, though.
Only five hours of work down the tubes thanks to this bug. No biggie. GAH!
Update: Michael Neumann has fixed this for the next release. Hooray!
Re:Do all DBD's handle comments?
djberg96 on 2003-01-31T22:47:36
I'm passing it to prepare(). The sql is stored in an external file, and I like to include comments so I remember what the point of the query was (in case I forget). Stripping the comments out is fine, but choking on them isn't.;) Re:Do all DBD's handle comments?
entropic on 2003-02-02T10:30:42
DBD::Pg knows how to handle comments w/ an "'" in the comments
there was a thread about rewriting DBD::Pg from scratch on the dbi list that discussed sql comments