HDBC-session 0.1.0.1 → 0.1.1.0
raw patch · 2 files changed
+20/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Database.HDBC.Session: withConnectionCommit :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
Files
- HDBC-session.cabal +2/−2
- src/Database/HDBC/Session.hs +18/−2
HDBC-session.cabal view
@@ -1,5 +1,5 @@ name: HDBC-session-version: 0.1.0.1+version: 0.1.1.0 synopsis: Bracketed connection for HDBC description: This package contains a base bracketed function to call close correctly against opend DB connection.@@ -8,7 +8,7 @@ license-file: LICENSE author: Kei Hibino maintainer: ex8k.hibino@gmail.com-copyright: Copyright (c) 2013-2014 Kei Hibino+copyright: Copyright (c) 2013-2016 Kei Hibino category: Database build-type: Simple cabal-version: >=1.10
src/Database/HDBC/Session.hs view
@@ -2,7 +2,7 @@ -- | -- Module : Database.HDBC.Session--- Copyright : 2013 Kei Hibino+-- Copyright : 2013-2016 Kei Hibino -- License : BSD3 -- -- Maintainer : ex8k.hibino@gmail.com@@ -14,8 +14,11 @@ module Database.HDBC.Session ( -- * Bracketed session -- $bracketedSession- withConnection, withConnectionIO, withConnectionIO',+ withConnectionCommit,+ withConnectionIO, withConnectionIO', + withConnection,+ -- * Show errors -- $showErrors showSqlError, handleSqlError'@@ -76,6 +79,19 @@ -> (conn -> IO a) -- ^ Transaction body -> IO a -- ^ Result transaction action withConnectionIO = withConnection bracket id++-- | Same as 'withConnectionIO' other than issuing commit at the end of transaction body.+-- In other words, the transaction with no exception is committed.+-- Handy defintion for simple transactions.+withConnectionCommit :: IConnection conn+ => IO conn -- ^ Connect action+ -> (conn -> IO a) -- ^ Transaction body+ -> IO a -- ^ Result transaction action+withConnectionCommit conn body =+ withConnectionIO conn $ \c -> do+ x <- body c+ HDBC.commit c+ return x -- | Same as 'withConnectionIO' other than wrapping transaction body in 'handleSqlError''. withConnectionIO' :: IConnection conn