From 333a163ac22e1e68576b2fbf3adc1be152d211b6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 10 May 2008 00:31:35 +0000 Subject: [PATCH] edits --- doc/build/content/session.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/build/content/session.txt b/doc/build/content/session.txt index be028d769b..cbe044293d 100644 --- a/doc/build/content/session.txt +++ b/doc/build/content/session.txt @@ -283,11 +283,11 @@ Expunge removes an object from the Session, sending persistent instances to the {python} session.expunge(obj1) -To remove all items, call `session.expunge_all()`. +To remove all items, call `session.expunge_all()` (this method was formerly known as `clear()`). ### Closing -The `close()` method issues a `expunge_alll()`, and releases any transactional/connection resources. When connections are returned to the connection pool, transactional state is rolled back as well. +The `close()` method issues a `expunge_all()`, and releases any transactional/connection resources. When connections are returned to the connection pool, transactional state is rolled back as well. ### Refreshing / Expiring @@ -417,6 +417,8 @@ The `begin()` method also returns a transactional token which is compatible with item1.foo = 'bar' item2.bar = 'foo' +### Using SAVEPOINT {@name=savepoint} + SAVEPOINT transactions, if supported by the underlying engine, may be delineated using the `begin_nested()` method: {python} @@ -435,6 +437,8 @@ SAVEPOINT transactions, if supported by the underlying engine, may be delineated When `begin_nested()` is called, a `flush()` is unconditionally issued (regardless of the `autoflush` setting). This is so that when a `rollback()` occurs, the full state of the session is expired, thus causing all subsequent attribute/instance access to reference the full state of the `Session` right before `begin_nested()` was called. +### Enabling Two-Phase Commit {@name=twophase} + Finally, for MySQL, Postgres, and soon Oracle as well, the session can be instructed to use two-phase commit semantics. This will coordinate the commiting of transactions across databases so that the transaction is either committed or rolled back in all databases. You can also `prepare()` the session for interacting with transactions not managed by SQLAlchemy. To use two phase transactions set the flag `twophase=True` on the session: {python} -- 2.47.3