@@ -91,9 +91,11 @@ module Database.PostgreSQL.Simple
9191 , defaultTransactionMode
9292 , defaultIsolationLevel
9393 , defaultReadWriteMode
94+ , withTransactionLevel
9495 , withTransactionMode
9596-- , Base.autocommit
9697 , begin
98+ , beginLevel
9799 , beginMode
98100 , commit
99101 , rollback
@@ -524,6 +526,11 @@ withTransaction :: Connection -> IO a -> IO a
524526withTransaction = withTransactionMode defaultTransactionMode
525527
526528-- | Execute an action inside a SQL transaction with a given isolation level.
529+withTransactionLevel :: IsolationLevel -> Connection -> IO a -> IO a
530+withTransactionLevel lvl
531+ = withTransactionMode defaultTransactionMode { isolationLevel = lvl }
532+
533+-- | Execute an action inside a SQL transaction with a given transaction mode.
527534withTransactionMode :: TransactionMode -> Connection -> IO a -> IO a
528535withTransactionMode mode conn act = do
529536 beginMode mode conn
@@ -544,6 +551,10 @@ begin :: Connection -> IO ()
544551begin = beginMode defaultTransactionMode
545552
546553-- | Begin a transaction with a given isolation level
554+beginLevel :: IsolationLevel -> Connection -> IO ()
555+beginLevel lvl = beginMode defaultTransactionMode { isolationLevel = lvl }
556+
557+-- | Begin a transaction with a given transaction mode
547558beginMode :: TransactionMode -> Connection -> IO ()
548559beginMode mode conn = do
549560 execute_ conn $! case mode of