postgresql-libpq 0.8.2 → 0.8.2.1
raw patch · 2 files changed
+18/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Database/PostgreSQL/LibPQ.hsc +16/−2
- postgresql-libpq.cabal +2/−2
Database/PostgreSQL/LibPQ.hsc view
@@ -229,6 +229,10 @@ ) import qualified Data.ByteString as B +#if __GLASGOW_HASKELL__ >= 700+import Control.Concurrent (newMVar, tryTakeMVar)+#endif+ -- $dbconn -- The following functions deal with making a connection to a -- PostgreSQL backend server. An application program can have several@@ -263,7 +267,7 @@ if connPtr == nullPtr then fail "libpq failed to allocate a PGconn structure" #if __GLASGOW_HASKELL__ >= 700- else Conn `fmap` FC.newForeignPtr connPtr (pqfinish connPtr)+ else Conn `fmap` newForeignPtrOnce connPtr (pqfinish connPtr) #else else Conn `fmap` newForeignPtr p_PQfinish connPtr #endif@@ -276,7 +280,7 @@ if connPtr == nullPtr then fail "libpq failed to allocate a PGconn structure" #if __GLASGOW_HASKELL__ >= 700- else Conn `fmap` FC.newForeignPtr connPtr (pqfinish connPtr)+ else Conn `fmap` newForeignPtrOnce connPtr (pqfinish connPtr) #else else Conn `fmap` newForeignPtr p_PQfinish connPtr #endif@@ -290,6 +294,16 @@ -- This case may be worth investigating further c_PQfinish conn fd -> closeFdWith (\_ -> c_PQfinish conn) (Fd fd)++-- | Workaround for bug in 'FC.newForeignPtr' before base 4.6. Ensure the+-- finalizer is only run once, to prevent a segfault. See GHC ticket #7170+--+-- Note that 'getvalue' and 'maybeBsFromForeignPtr' do not need this+-- workaround, since their finalizers are just 'touchForeignPtr' calls.+newForeignPtrOnce :: Ptr a -> IO () -> IO (ForeignPtr a)+newForeignPtrOnce ptr fin = do+ mv <- newMVar fin+ FC.newForeignPtr ptr $ tryTakeMVar mv >>= maybe (return ()) id #endif -- | Allocate a Null Connection, which all libpq functions
postgresql-libpq.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-libpq-Version: 0.8.2+Version: 0.8.2.1 Synopsis: low-level binding to libpq Description: This is a binding to libpq: the C application@@ -38,4 +38,4 @@ source-repository this type: git location: http://github.com/lpsmith/postgresql-libpq- tag: v0.8.2+ tag: v0.8.2.1