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

Andy Dustman adustman@comstar.net
Mon, 3 Jul 2000 11:51:10 -0400 (EDT)


On Mon, 3 Jul 2000, Monty Taylor wrote:

> Why not have one ZmySQLDA that attempts to determine whether it is 
> transactional or not when the connect method is executed. That way you 
> could have a DA connect to your 3.22 database, upgrade your database to 
> >3.23.15 and not see any problems. A combination of try-except:ing an 
> attempted "begin rollback" block and a test for database type should do 
> the trick, no? If it's 3.22 or earlier, the begin-rollback should throw 
> the synax error Andy mentioned. If that's ok, a test for database type 
> (not sure about this one) to see if it's BDB? If all of this is wrapped 
> in the connect method, we should be able to make it 'do the right thing' 

There are two factors which determine whether or not transactions can be
supported. Actually, there's only one, but it can't be directly tested
for:

1) If the server version (easily obtained upon establishing the
connection) is < 3.23.15, transactions are definitely not supported.

2) If the database in use employs BDB tables, transactions are definitely
supported.

The problem is: Support for the transaction manager is done with a MixIN
class, so the decision on whether or not transactions should be supported
in the DA comes before the connection object is created. Which raises an
interesting possibility: On the connection object's Properties tab, add a
checkbox which indicates that transactional semantics are required. The
status of this checkbox determines which class is used for the database
connection. This might be workable, not really sure.

-- 
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!"