Michael Neumann <uu9r / rz.uni-karlsruhe.de> wrote in message news:<20030201110023.GB5574 / rz.uni-karlsruhe.de>... > Berger, Daniel wrote: > > Hi all, > > > > Ruby 1.6.8 > > ruby-dbi 0.18 > > oracle 0.2.11 (ruby driver) > > Oracle 8.1.5 (oracle) > > Solaris 9 > > > > I've noticed a parsing problem with leading sql comments and sql that ends > > with a placeholder. For example, > > > > --random comment > > select column1, column2 > > from table1 > > where somevalue > ? > > > > In both ruby and TORA, this causes oracle error 24374: "define not done > > before fetch or execute and fetch". However, I do not get this error via > > sqlplus or TOAD, so I'm fairly certain it's not an Oracle client side issue. > > It appears to be some sort of sql parsing problem. > > > > Interestingly, changing the "?" to a fixed value fixes the parsing error in > > ruby-dbi, although TORA still chokes. > > > > Is this an oracle driver problem or a ruby-dbi problem? And can it be fixed > > (please)? > > It should be simple to fix. All we have to do is to split the SQL statement into > lines (separated by \n), then sort those out starting with --, and finally join > it again to proceed with the usual tokenizing steps. > > I'll put this into 0.0.19. > Are there problems with "--" comments for other databases than Oracle? > Or should I only process comments for the Oracle-DBD? > > Regards, > > Michael > Actually Michael, see my "upon further review" message. It turns out that it only has a problem if there's an apostrophe in the comment when used with a placeholder. So, "--random comment" works fine, but "--Dan's minstrel wrote this" does not. The problem occurs in the tokens() method in sql.rb. Regards, Dan