On 4/11/07, John Siracusa <[EMAIL PROTECTED]> wrote:
> If you db supports it, you could try going into a serialized isolation
> mode and then doing all your operations in a single transaction.

It does.  "SET TRANSACTION ISOLATION LEVEL repeatable read" will cause
all of your SELECT statements to be SELECT... FOR UPDATE until you
change it back.

However, it's usually better to do this kind of thing with an atomic update:

UPDATE seq SET count = count + 1 WHERE name = 'foo'

If you want that value back, you can grab it like this:

UPDATE seq SET count = LAST_INSERT_ID(count + 1) WHERE name = 'foo'
SELECT LAST_INSERT_ID()

This is actually almost identical to the example from the
documentation for the LAST_INSERT_ID function.

- Perrin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to