packages feed

hpqtypes 1.2.2 → 1.2.3

raw patch · 2 files changed

+6/−8 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hpqtypes.cabal view
@@ -1,5 +1,5 @@ name:                hpqtypes-version:             1.2.2+version:             1.2.3 synopsis:            Haskell bindings to libpqtypes  description:         Efficient and easy-to-use bindings to (slightly modified)
src/Database/PostgreSQL/PQTypes/Binary.hs view
@@ -6,14 +6,12 @@   ) where  import Control.Applicative-import Data.ByteString.Unsafe import Data.Typeable import qualified Data.ByteString.Char8 as BS  import Database.PostgreSQL.PQTypes.Format import Database.PostgreSQL.PQTypes.FromSQL import Database.PostgreSQL.PQTypes.Internal.C.Types-import Database.PostgreSQL.PQTypes.Internal.Utils import Database.PostgreSQL.PQTypes.ToSQL  -- | Wrapper for (de)serializing underlying type as 'bytea'.@@ -29,11 +27,11 @@  instance FromSQL (Binary BS.ByteString) where   type PQBase (Binary BS.ByteString) = PGbytea-  fromSQL Nothing = unexpectedNULL-  fromSQL (Just PGbytea{..}) = Binary-    <$> BS.packCStringLen (pgByteaData, fromIntegral pgByteaLen)+  -- use handler for ByteStringS for convenience+  fromSQL mbase = Binary <$> fromSQL mbase  instance ToSQL (Binary BS.ByteString) where   type PQDest (Binary BS.ByteString) = PGbytea-  toSQL (Binary bs) _ conv = unsafeUseAsCStringLen bs $ \cslen ->-    put (cStringLenToBytea cslen) conv+  -- use handler for ByteStringS as it properly handles+  -- the case when underlying ByteString pointer is NULL.+  toSQL (Binary bs) = toSQL bs