packages feed

hasql 1.8.0.2 → 1.8.1

raw patch · 2 files changed

+16/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hasql.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: hasql-version: 1.8.0.2+version: 1.8.1 category: Hasql, Database, PostgreSQL synopsis: Fast PostgreSQL driver with a flexible mapping API description:@@ -75,6 +75,7 @@     StandaloneDeriving     StrictData     TupleSections+    TypeApplications     TypeFamilies     TypeOperators 
library/Hasql/Session/Core.hs view
@@ -8,6 +8,7 @@ import Hasql.Encoders.Params qualified as Encoders.Params import Hasql.Errors import Hasql.IO qualified as IO+import Hasql.LibPq14 qualified as Pq import Hasql.Pipeline.Core qualified as Pipeline import Hasql.Prelude import Hasql.Statement qualified as Statement@@ -22,8 +23,20 @@ -- Executes a bunch of commands on the provided connection. run :: Session a -> Connection.Connection -> IO (Either SessionError a) run (Session impl) connection =-  runExceptT+  handle @SomeException onExc+    $ runExceptT     $ runReaderT impl connection+  where+    onExc exc =+      case connection of+        Connection.Connection pqConnVar _ _ ->+          withMVar pqConnVar onPqConn+      where+        onPqConn pqConn = do+          Pq.transactionStatus pqConn >>= \case+            Pq.TransIdle -> pure ()+            _ -> Pq.reset pqConn+          throwIO exc  -- | -- Possibly a multi-statement query,