[Zope] MySQL transaction support (was: MySQL Select Statements)

Andy Dustman adustman@comstar.net
Fri, 30 Jun 2000 16:07:44 -0400 (EDT)


On Fri, 30 Jun 2000, Ron Bickers wrote:

> > That's the problem: They don't get control over when BEGIN/COMMIT/ROLLBACK
> > are used. Zope does that if you are using the Transaction Manager. And the
> > only way to control use of the Transaction Manager is by
> > selection of DA.
> >
> > That's why I think it may be necessary to have two ZMySQLDAs: One which is
> > transactional and one which is not. However, they can both be part of the
> > same distribution, and the transactional one can simply subclass the
> > non-transactional one (mixing in the TM base and adding the required
> > methods), so there is not a lot of code duplication.
> 
> I see.  So how would this affect use of transaction and non-transaction
> supporting tables?  Would two separate database connections be required
> where the SQLMethod must use the correct connection depending on transaction
> support?
> 
> Making assumptions is bad, but suppose MySQL 3.23 does something elegant
> with BEGIN/COMMIT/ROLLBACK attempts on non-transaction supporting tables
> (like return a "table does not support transactions" or simply ignores that
> statement).  Could we then just have one DA for 3.22 and another for 3.23,
> where the 3.23 DA handles transactions, but silently ignores them when
> dealing with non-transaction tables?

These are good questions. But I don't have good answers yet. I tried BEGIN
and COMMIT when I didn't even have a database selected, and it took it. It
may silently accept ROLLBACK when rollback is impossible, or it may raise
an error. I haven't done that much testing with MySQL-3.23 yet, and none
with BDB tables. But it may be possible to break things down as having a
DA for 3.22 and one for 3.23. Which is, in practice, may not be any
different than having one that is not transactional (3.22 never is) and
one that is transactional (3.23 sometimes is).

-- 
andy dustman       |     programmer/analyst     |      comstar.net, inc.
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d
"Therefore, sweet knights, if you may doubt your strength or courage, 
come no further, for death awaits you all, with nasty, big, pointy teeth!"