[Zope-DB] Are transactions/atomicity implicit in ZSQL+ Oracle ?
Thu, 21 Mar 2002 12:06:43 +0100 (MET)
En réponse à kapil thangavelu <firstname.lastname@example.org>:
> > I need to make a ZSQL method that inserts data in a table this way:
> > 1) first, generate a new ID with something like SELECT MAX(ID)+1 AS
> > FROM ...
> > 2) then, INSERT with the ID previously generated ( is INSERT INTO
> > VALUES (<dtml-var my_id>.... the right way to do this ?)
> it would be much better to use a sequence. the above is only safe in a
> transaction serialized mode.
Unfortunately I can't modify the db structure or even add simple objects.
My question is precisely this: is there explicit LOCKing to do to ensure
serialization or does Zope do it automatically for all SQL statements in a
single ZSQL method?
> > Also (main question), is there something particular to do to ensure
> > SELECT+INSERT is done in a single transaction, thus avoiding
> > problems ?
> zope's integration with databases depends on whats supported by the
> adapter. if the adapter supports transactions than zope will commit
> transactions involving any changed persistent objects within zope and
> the dbs
> at the end of a request.
By 'request' you mean http request ?
If the Oracle DA supports transactions, which I guess it does, am I right to
assume that the 2 SQL statements inside my ZSQL method are an atomic operation ?