On 6/27/07, Michael Lackhoff <[EMAIL PROTECTED]> wrote:
> It is a web app with lots of database activity (read and write). So
> performance and data integrity is an issue and my idea is to use Apache::DBI
> with autocommit => 0.

FWIW, I take the opposite approach: AutoCommit is on, and I explicitly
perform transactions (usually using $db->do_transaction) when I want
to perform many related actions successfully, or not at all.  (Of
course the implicit transactions on save() also happen in this setup.)

> If yes, my question is, how all the RDBO internals work with such a setup. If
> I remember correctly RDBO wraps complex saves or deletes within a transaction.
> Would this lead to something like nested transactions? Is this possible at
> all, with sqlite (I am using now) and postgres (I would like to use after some
> more learning)?

Nested transactions are not supported by RDBO.  If a database handle
is already in a transaction, RDBO will not start a new one, nor will
it commit the existing one.

> And if it works in principle do I have to stuff the $dbh manually into every
> RDBO object or does it "just work" because Apache::DBI takes care that RDBO
> gets the right (perhaps reused) handle even if RDBO always requests a fresh
> one?

If you use the default init_db() implementation (which just returns
Rose::DB->new), then under Apache::DBI, all Rose::DB::Object objects
will have their own Rose::DB object, but every Rose::DB object will
share a single DBI $dbh (and therefore a single database connaction).
This is the setup that I use.

More discussion in this thread:

http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg01803.html

(I think there was another, longer post with more examples, but I
can't find it now...)

-John

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to