postgresql-libpq 0.9.0.1 → 0.9.0.2
raw patch · 3 files changed
+41/−20 lines, 3 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Setup.hs +12/−6
- postgresql-libpq.cabal +15/−5
- src/Database/PostgreSQL/LibPQ.hsc +14/−9
Setup.hs view
@@ -1,6 +1,7 @@ #!/usr/bin/env runhaskell import Distribution.Simple+import Distribution.Simple.Setup import Distribution.PackageDescription import Distribution.Version @@ -13,13 +14,18 @@ main = defaultMainWithHooks simpleUserHooks { confHook = \pkg flags -> do- lbi <- confHook simpleUserHooks pkg flags- bi <- psqlBuildInfo lbi+ if lookup (FlagName "use-pkg-config") + (configConfigurationsFlags flags) == Just True+ then do+ confHook simpleUserHooks pkg flags+ else do+ lbi <- confHook simpleUserHooks pkg flags+ bi <- psqlBuildInfo lbi - return lbi {- localPkgDescr = updatePackageDescription- (Just bi, [("runtests", bi)]) (localPkgDescr lbi)- }+ return lbi {+ localPkgDescr = updatePackageDescription+ (Just bi, [("runtests", bi)]) (localPkgDescr lbi)+ } } psqlBuildInfo :: LocalBuildInfo -> IO BuildInfo
postgresql-libpq.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-libpq-Version: 0.9.0.1+Version: 0.9.0.2 Synopsis: low-level binding to libpq Description: This is a binding to libpq: the C application@@ -20,6 +20,13 @@ Build-type: Custom -- Extra-source-files: Cabal-version: >=1.8++-- If true, use pkg-config, otherwise use the pg_config based build+-- configuration+Flag use-pkg-config+ default: False+ manual: True+ Library hs-source-dirs: src Exposed-modules: Database.PostgreSQL.LibPQ@@ -28,9 +35,12 @@ , bytestring GHC-Options: -Wall- Extra-Libraries: pq- if os(openbsd)- Extra-Libraries: crypto ssl+ if flag(use-pkg-config)+ Pkgconfig-depends: libpq+ else+ Extra-Libraries: pq+ if os(openbsd)+ Extra-Libraries: crypto ssl -- Other-modules: Build-tools: hsc2hs@@ -42,4 +52,4 @@ source-repository this type: git location: http://github.com/lpsmith/postgresql-libpq- tag: v0.9.0.1+ tag: v0.9.0.2
src/Database/PostgreSQL/LibPQ.hsc view
@@ -232,7 +232,7 @@ ) import qualified Data.ByteString as B -#if __GLASGOW_HASKELL__ >= 700 && __GLASGOW_HASKELL__ < 706+#if __GLASGOW_HASKELL__ >= 700 import Control.Concurrent (newMVar, tryTakeMVar) #endif @@ -273,10 +273,12 @@ connectdb :: B.ByteString -- ^ Connection Info -> IO Connection connectdb conninfo =- do connPtr <- B.useAsCString conninfo c_PQconnectdb+ mask_ $ do+ connPtr <- B.useAsCString conninfo c_PQconnectdb if connPtr == nullPtr then fail "libpq failed to allocate a PGconn structure"-#if __GLASGOW_HASKELL__ >= 706+#if 0+-- FIXME: #if __GLASGOW_HASKELL__ >= ??? else Conn `fmap` FC.newForeignPtr connPtr (pqfinish connPtr) #elif __GLASGOW_HASKELL__ >= 700 else Conn `fmap` newForeignPtrOnce connPtr (pqfinish connPtr)@@ -288,10 +290,12 @@ connectStart :: B.ByteString -- ^ Connection Info -> IO Connection connectStart connStr =- do connPtr <- B.useAsCString connStr c_PQconnectStart+ mask_ $ do+ connPtr <- B.useAsCString connStr c_PQconnectStart if connPtr == nullPtr then fail "libpq failed to allocate a PGconn structure"-#if __GLASGOW_HASKELL__ >= 706+#if 0+-- FIXME: #if __GLASGOW_HASKELL__ >= ??? else Conn `fmap` FC.newForeignPtr connPtr (pqfinish connPtr) #elif __GLASGOW_HASKELL__ >= 700 else Conn `fmap` newForeignPtrOnce connPtr (pqfinish connPtr)@@ -316,7 +320,7 @@ fd -> closeFdWith (\_ -> c_PQfinish conn) (Fd fd) #endif -#if __GLASGOW_HASKELL__ >= 700 && __GLASGOW_HASKELL__ < 706+#if __GLASGOW_HASKELL__ >= 700 -- | 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 --@@ -1832,7 +1836,7 @@ getCancel :: Connection -> IO (Maybe Cancel) getCancel connection =- withConn connection $ \conn ->+ mask_ $ withConn connection $ \conn -> do ptr <- c_PQgetCancel conn if ptr == nullPtr then return Nothing@@ -2002,7 +2006,8 @@ -> (Ptr PGconn -> IO (Ptr PGresult)) -> IO (Maybe Result) resultFromConn connection f =- do resPtr <- withConn connection f+ mask_ $ do+ resPtr <- withConn connection f if resPtr == nullPtr then return Nothing else (Just . Result) `fmap` newForeignPtr p_PQclear resPtr@@ -2406,7 +2411,7 @@ foreign import ccall unsafe "libpq-fe.h PQconsumeInput" c_PQconsumeInput :: Ptr PGconn -> IO CInt -foreign import ccall "libpq-fe.h PQisBusy"+foreign import ccall unsafe "libpq-fe.h PQisBusy" c_PQisBusy :: Ptr PGconn -> IO CInt foreign import ccall "libpq-fe.h PQsetnonblocking"