logo       

A couple of bugs in sqlite DBD/DBI: msg#00001

Subject: A couple of bugs in sqlite DBD/DBI
Hello,

I'd like to report a couple of bugs in the sqlite DBD/DBI. Well, the first
is definitely a bug, but you might argue the second with me :-)

The first issue: DBI::DatabaseHandle#do should return a row processed count,
but it returns nil. You can workaround it by using #execute instead, which
gives you a StatementHandle you can call #rows on.

The second problem is to do with transactions and locking. When you open a
sqlite database, and you have 'AutoCommit'=>false (the default and most
useful setting), the DBD sends

    begin transaction

immediately to the database. Unfortunately, this causes sqlite to obtain an
exclusive write-lock on the file, and any concurrent connection by another
process (or even a second DBI handle in the first process) is completely
blocked out. An attempt to open a second connection causes an exception to
be raised.

I think it would be better if the 'begin transaction' were deferred until
later, for example when doing

   db.transaction do        # begin transaction
      ..
      .. stuff
      ..                    
   end                      # commit or rollback

However that I think needs some changes to the underlying DBI->DBD API,
which has methods for 'commit' and 'rollback' but not 'begin'.

I'd be interested to hear what people think, but I thought the whole purpose
of DBI/DBD was to isolate me from the differences between databases; for my
application I've now had to write a wrapper object so that I can make it
work both with dbi:sqlite and dbi:mysql, because of this issue.

The main reason for including sqlite is as part of the unit testing suite,
rather than intended for major rollout, but I still think it would be nice
to maintain support for as many backends as possible.

Regards,

Brian Candler.

Attachment: bug_sqlite1.rb
Description: Text document

Attachment: bug_sqlite2.rb
Description: Text document

_______________________________________________
Ruby-dbi-devel mailing list
Ruby-dbi-devel@xxxxxxxxxxxxx
http://rubyforge.org/mailman/listinfo/ruby-dbi-devel
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe