|
From: Brian C. <B.C...@po...> - 2003-03-27 22:04:15
|
Hello,
I was pointed in the direction of this list from ruby-talk by Paul DuBois
(thanks Paul). I heard there's now transaction support for Mysql in CVS for
ruby-dbi. I just added this in myself too, so looks like I was wasting my
time :-)
I've had a look at the changes in Mysql.rb from 1.19 to 1.20, and it looks
good. My only comment/observation is about the thread-safety of this patch.
The code says:
def commit
if @have_transactions
@handle.query("COMMIT")
else ...
(similarly for rollback and setting autocommit mode). However, everywhere
else that calls query() is protected by @mutex. So shouldn't these
statements have the same protection? Or is the possibility of two threads
interfering on a transaction so horrible to contemplate that it's not worth
putting up any pretence of protection? (Perhaps DatabaseHandle#transaction
should have its own mutex? But that wouldn't protect you if you just did
commit/rollback yourself)
Apart from that, would it perhaps be time for a new release of ruby-dbi?
While I'm here, a couple of other things I noticed.
(1) In the pg driver:
if attr =~ /^pg_/ or attr != /_/
^^^^^^^^^^^
I think that should be "attr !~ /_/" otherwise I can't see how it does
anything useful.
(2) There is a note from mneumann on the project page under 'RFE' saying
'Write a DBD based on the package Ruby/OCI8, when this becomes stable.' I'd
just like to say that I've been using Ruby/OCI8 with Oracle 9i quite heavily
for the last couple of weeks, with the DBD which comes with it. Once a few
bugs had been ironed out (the author released 0.1.2) it's working
beautifully.
Regards,
Brian.
|