Changeset 15519 in project


Ignore:
Timestamp:
08/19/09 21:33:13 (10 years ago)
Author:
sjamaan
Message:

Describe new transaction support procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/postgresql

    r14901 r15519  
    3434[[http://www.postgresql.org|PostgreSQL]] relational database.
    3535
    36 ==== Connection functions
     36==== Connection management
    3737
    3838<procedure>(connect CONNECTION-SPEC [TYPE-PARSERS [TYPE-UNPARSERS]])</procedure>
     
    286286</example>
    287287</examples>
     288
     289===== Transaction management
     290
     291<procedure>(with-transaction CONN THUNK)</procedure>
     292
     293Execute {{THUNK}} within a {{BEGIN TRANSACTION}} block, and return
     294the value of {{thunk}}.
     295
     296The transaction is committed if {{thunk}} returns a true value.  If an
     297exception occurs during {{thunk}}, or {{thunk}} returns {{#f}}, or the
     298commit fails, the transaction will be rolled back. If this rollback
     299fails, that is a critical error and you should likely abort.
     300
     301Nested applications of {{with-transaction}} '''are''' supported --
     302only those statements executed within {{THUNK}} are committed or
     303rolled back by any {{with-transaction}} call, as you would expect.
     304
     305However, escaping or re-entering the dynamic extent of {{thunk}} will
     306not commit or rollback the in-progress transaction, so it is highly
     307discouraged to jump out of a transaction.  You will definitely run
     308into trouble, unless you can ensure that no other statements will be
     309executed on this connection until the outermost {{with-transaction}}
     310returns normally.
     311
     312<procedure>(in-transaction? CONN)</procedure>
     313
     314Returns {{#t}} if there is currently a transaction in progress on the
     315connection {{CONN}}.  Returns {{#f}} if no transaction is in progress.
    288316
    289317==== Low-level API
     
    600628=== Changelog
    601629
     630* 3.2 - Add transaction support.
    602631* 3.1 - Small (but backwards incompatible) interface improvement: make row and column arguments optional.
    603632* 3.0 - Port to Chicken 4.  Major code overhaul, backwards incompatible.
Note: See TracChangeset for help on using the changeset viewer.