[prev in list] [next in list] [prev in thread] [next in thread]
List: mtos-dev
Subject: [MTOS-dev] begin_work method() in Data::ObjectDriver::Driver::DBI
From: "Hirotaka Ogawa" <hirotaka.ogawa () gmail ! com>
Date: 2008-04-21 10:53:50
Message-ID: 3ec110d70804210353mdedce0dte5f70b8f1cd18047 () mail ! gmail ! com
[Download RAW message or body]
Hi,
I have a question about begin_work() method in Data::ObjectDriver::Driver::DBI.
Almost D::OD::Driver::DBI methods first get dbh handle through
r_handle() or rw_handle(), and do some queries with using this dbh.
But, begin_work() method gets dbh handle through $driver->dbh, and
executes a command with using this dbh.
So, if we lost a DB connection before executing begin_work(), we
couldn't execute it properly.
I think a patch below is needed.
Index: extlib/Data/ObjectDriver/Driver/DBI.pm
===================================================================
--- extlib/Data/ObjectDriver/Driver/DBI.pm (revision 467)
+++ extlib/Data/ObjectDriver/Driver/DBI.pm (working copy)
@@ -528,6 +528,8 @@
$driver->{__delete_dbh_after_txn} = 1;
$dbh = $driver->rw_handle;
$driver->dbh($dbh);
+ } else {
+ $dbh = $driver->rw_handle;
}
eval {
$dbh->begin_work;
FYI, commit() and rollback() methods also behave as like begin_work(),
but I think no additional changes are required for these methods.
Because, commit() and rollback() methods would be meaningless when a
DB connection has been lost. In such a case, transactions being
handled would be automatically rollbacked, perhaps.
--
Hirotaka Ogawa
http://twitter.com/ogawa
http://as-is.net/blog/
_______________________________________________
MTOS-dev mailing list
MTOS-dev@sixapart.com
http://www.sixapart.com/mailman/listinfo/mtos-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic