packages feed

postgresql-libpq 0.9.4.2 → 0.9.4.3

raw patch · 6 files changed

+126/−75 lines, 6 filesdep ~Win32dep ~basedep ~bytestringPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: Win32, base, bytestring

API changes (from Hackage documentation)

- Database.PostgreSQL.LibPQ: toColumn :: (Integral a) => a -> Column
+ Database.PostgreSQL.LibPQ: toColumn :: Integral a => a -> Column
- Database.PostgreSQL.LibPQ: toRow :: (Integral a) => a -> Row
+ Database.PostgreSQL.LibPQ: toRow :: Integral a => a -> Row
- Database.PostgreSQL.LibPQ.Internal: Conn :: {-# UNPACK #-} !(ForeignPtr PGconn) -> {-# UNPACK #-} !(MVar NoticeBuffer) -> Connection
+ Database.PostgreSQL.LibPQ.Internal: Conn :: {-# UNPACK #-} !ForeignPtr PGconn -> {-# UNPACK #-} !MVar NoticeBuffer -> Connection

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+0.9.4.3+-------++- Support `bytestring-0.11`+- Allow `Win32-2.10.0.0`+- Make `PQconsumeInput` FFI call `safe`+ 0.9.4.2 ------- 
postgresql-libpq.cabal view
@@ -1,69 +1,80 @@-Name:                postgresql-libpq-Version:             0.9.4.2-Synopsis:            low-level binding to libpq+name:               postgresql-libpq+version:            0.9.4.3+synopsis:           low-level binding to libpq+description:+  This is a binding to libpq: the C application+  programmer's interface to PostgreSQL. libpq is a+  set of library functions that allow client+  programs to pass queries to the PostgreSQL+  backend server and to receive the results of+  these queries. -Description:         This is a binding to libpq: the C application-                     programmer's interface to PostgreSQL. libpq is a-                     set of library functions that allow client-                     programs to pass queries to the PostgreSQL-                     backend server and to receive the results of-                     these queries.+homepage:           https://github.com/haskellari/postgresql-libpq+bug-reports:        https://github.com/haskellari/postgresql-libpq/issues+license:            BSD3+license-file:       LICENSE+author:             Grant Monroe, Leon P Smith, Joey Adams+maintainer:         Oleg Grenrus <oleg.grenrus@iki.fi>+copyright:+  (c) 2010 Grant Monroe+  (c) 2011 Leon P Smith -Homepage:            https://github.com/phadej/postgresql-libpq-License:             BSD3-License-file:        LICENSE-Author:              Grant Monroe, Leon P Smith, Joey Adams-Maintainer:          Oleg Grenrus <oleg.grenrus@iki.fi>-Copyright:           (c) 2010 Grant Monroe-                     (c) 2011 Leon P Smith-Category:            Database-Build-type:          Custom-Extra-source-files:  cbits/noticehandlers.h-Cabal-version:       >=1.8-Tested-with:-  GHC==7.0.4,-  GHC==7.2.2,-  GHC==7.4.2,-  GHC==7.6.3,-  GHC==7.8.4,-  GHC==7.10.3,-  GHC==8.0.2,-  GHC==8.2.2,-  GHC==8.4.3,-  GHC==8.6.1+category:           Database+build-type:         Custom+extra-source-files: cbits/noticehandlers.h+cabal-version:      >=1.10+tested-with:+  GHC ==7.0.4+   || ==7.2.2+   || ==7.4.2+   || ==7.6.3+   || ==7.8.4+   || ==7.10.3+   || ==8.0.2+   || ==8.2.2+   || ==8.4.4+   || ==8.6.5+   || ==8.8.4+   || ==8.10.2 -extra-source-files:-  CHANGELOG.md+extra-source-files: CHANGELOG.md -Custom-setup+custom-setup   setup-depends:-    base >= 4.3 && <5, Cabal >= 1.10 && <2.5+      base   >=4.3  && <5+    , Cabal  >=1.10 && <3.3  -- If true,  use pkg-config,  otherwise use the pg_config based build -- configuration-Flag use-pkg-config+flag use-pkg-config   default: False   manual:  True -Library-  hs-source-dirs:      src-  c-sources:           cbits/noticehandlers.c-  include-dirs:        cbits-  Exposed-modules:     Database.PostgreSQL.LibPQ-                       Database.PostgreSQL.LibPQ.Internal-  Build-depends:       base       >=4.3     && <4.13-                     , bytestring >=0.9.1.0 && <0.11+library+  default-language: Haskell2010+  hs-source-dirs:   src+  c-sources:        cbits/noticehandlers.c+  include-dirs:     cbits+  exposed-modules:+    Database.PostgreSQL.LibPQ+    Database.PostgreSQL.LibPQ.Internal +  other-modules:    Database.PostgreSQL.LibPQ.Compat+  build-depends:+      base        >=4.3     && <4.15+    , bytestring  >=0.9.1.0 && <0.12+   if !os(windows)-    Build-depends:     unix  >=2.4.2.0 && <2.8+    build-depends: unix >=2.4.2.0 && <2.8    if os(windows)-    Build-depends:     Win32 >=2.2.0.2 && <2.7+    build-depends: Win32 >=2.2.0.2 && <2.11 -  GHC-Options:       -Wall+  ghc-options:      -Wall    if flag(use-pkg-config)-    Pkgconfig-depends:   libpq >=9.3+    pkgconfig-depends: libpq ==9.3 || >9.3+   else     if os(windows)       -- Due to https://sourceware.org/bugzilla/show_bug.cgi?id=22948,@@ -71,29 +82,29 @@       -- libpq.dll directly, which can lead to segfaults. As a temporary hack,       -- we force ld to link against the libpq.lib import library directly       -- by specifying libpq here.-      Extra-Libraries:   libpq+      extra-libraries: libpq+     else-      Extra-Libraries:     pq+      extra-libraries: pq+       if os(openbsd)-        Extra-Libraries:     crypto ssl+        extra-libraries:+          crypto+          ssl    -- Other-modules:-  Build-tools:       hsc2hs+  build-tools:      hsc2hs -any  test-suite smoke-  type:           exitcode-stdio-1.0-  main-is:        Smoke.hs-  hs-source-dirs: test+  default-language: Haskell2010+  type:             exitcode-stdio-1.0+  main-is:          Smoke.hs+  hs-source-dirs:   test   build-depends:-    base,-    bytestring,-    postgresql-libpq+      base+    , bytestring+    , postgresql-libpq  source-repository head   type:     git-  location: https://github.com/phadej/postgresql-libpq--source-repository this-  type:     git-  location: https://github.com/phadej/postgresql-libpq-  tag:      v0.9.4.0+  location: https://github.com/haskellari/postgresql-libpq
src/Database/PostgreSQL/LibPQ.hsc view
@@ -238,7 +238,6 @@ import qualified Data.ByteString.Internal as B ( fromForeignPtr                                                , c_strlen                                                , createAndTrim-                                               , ByteString(..)                                                ) import qualified Data.ByteString as B @@ -246,6 +245,7 @@  import Data.Typeable +import Database.PostgreSQL.LibPQ.Compat import Database.PostgreSQL.LibPQ.Internal  #if __GLASGOW_HASKELL__ >= 700@@ -1045,8 +1045,8 @@        return $ B.fromForeignPtr fp 0 $ fromIntegral len  --- | Returns the error message most recently generated by an operation--- on the connection.+-- | Returns the error message associated with the command, or an+-- empty string if there was no error. resultErrorMessage :: Result                    -> IO (Maybe B.ByteString) resultErrorMessage = flip maybeBsFromResult c_PQresultErrorMessage@@ -1203,9 +1203,9 @@ -- values, these functions will act as though the result has zero rows -- and zero columns. --- | Returns the number of rows (tuples) in the query result. Because--- it returns an integer result, large result sets might overflow the--- return value on 32-bit operating systems.+-- | Returns the number of rows (tuples) in the query result.  (Note+-- that PGresult objects are limited to no more than INT_MAX rows, so+-- an int result is sufficient.) ntuples :: Result         -> IO Row ntuples res = withResult res (return . toRow . c_PQntuples)@@ -2170,7 +2170,7 @@         else do           fp <- newForeignPtr finalizerFree (castPtr np)           len  <- #{peek PGnotice, len} np-          return $! Just $! B.PS fp (#offset PGnotice, str) len+          return $! Just $! mkPS fp (#offset PGnotice, str) len  -- $largeobjects @@ -2510,7 +2510,7 @@ foreign import ccall unsafe "libpq-fe.h PQnotifies"     c_PQnotifies :: Ptr PGconn -> IO (Ptr Notify) -foreign import ccall unsafe "libpq-fe.h PQconsumeInput"+foreign import ccall        "libpq-fe.h PQconsumeInput"     c_PQconsumeInput :: Ptr PGconn -> IO CInt  foreign import ccall unsafe "libpq-fe.h PQisBusy"
+ src/Database/PostgreSQL/LibPQ/Compat.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE MagicHash #-}+module Database.PostgreSQL.LibPQ.Compat where++import Data.ByteString.Internal (ByteString(..))+import Data.Word (Word8)+import Foreign.ForeignPtr (ForeignPtr)++#if MIN_VERSION_bytestring(0,11,0)+import Data.ByteString.Internal (plusForeignPtr)+#endif++withPS :: ByteString -> (ForeignPtr Word8 -> Int -> Int -> r) -> r+#if MIN_VERSION_bytestring(0,11,0)+withPS (BS fp len)     kont = kont fp 0   len+#else+withPS (PS fp off len) kont = kont fp off len+#endif+{-# INLINE withPS #-}++mkPS :: ForeignPtr Word8 -> Int -> Int -> ByteString+#if MIN_VERSION_bytestring(0,11,0)+mkPS fp off len = BS (plusForeignPtr fp off) len+#else+mkPS fp off len = PS fp off len+#endif+{-# INLINE mkPS #-}
src/Database/PostgreSQL/LibPQ/Internal.hs view
@@ -11,12 +11,13 @@ -- ----------------------------------------------------------------------------- -{-# LANGUAGE BangPatterns, EmptyDataDecls #-}+{-# LANGUAGE BangPatterns   #-}+{-# LANGUAGE EmptyDataDecls #-}  module Database.PostgreSQL.LibPQ.Internal where +import Control.Concurrent.MVar (MVar) import Foreign-import Control.Concurrent.MVar ( MVar )   -- | 'Connection' encapsulates a connection to the backend.
test/Smoke.hs view
@@ -10,7 +10,12 @@     env <- getEnvironment     case lookup "DATABASE_CONNSTRING" env of         Nothing -> putStrLn "Set DATABASE_CONNSTRING environment variable"-        Just s  -> smoke (BS8.pack s)+        Just s  -> smoke (BS8.pack (special s))+  where+    -- https://www.appveyor.com/docs/services-databases/+    special "appveyor" = "dbname='TestDb' user='postgres' password='Password12!'"+    special "travis"   = ""+    special s          = s  smoke :: BS8.ByteString -> IO () smoke connstring = do