On Tuesday 15 January 2002 01:28 pm, Chris Meyers wrote:
This works really well, but could cause problems if the db is heavily used. Another transaction could sneak in between your INSERT and the SELECT and throw off your count (unless Zope wraps ZSQL Methods in a transaction block which I am not sure about). You could do something like this if you want to be really sure that no new ids are slipped in:
We've tested this pretty extensively in our situation and with Psycopg the entire request is in a single transaction so there is no problem with another transaction "sneaking in". Zope handles this automatically for you with psycopg and postgres as long as you don't try to do the transactional work yourself. You can verify this by turning on logging in postgres and watching the logs. -Chris -- Chris Kratz Systems Analyst/Programmer VistaShare LLC www.vistashare.com