postgresql-libpq 0.8.2.2 → 0.8.2.3
raw patch · 2 files changed
+14/−17 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Database/PostgreSQL/LibPQ.hsc +12/−15
- postgresql-libpq.cabal +2/−2
Database/PostgreSQL/LibPQ.hsc view
@@ -226,6 +226,7 @@ import qualified Data.ByteString.Unsafe as B import qualified Data.ByteString.Internal as B ( fromForeignPtr , c_strlen+ , createAndTrim ) import qualified Data.ByteString as B @@ -1413,19 +1414,16 @@ -> B.ByteString -> IO (Maybe B.ByteString) escapeStringConn connection bs =- withConn connection $ \conn ->- B.unsafeUseAsCStringLen bs $ \(from, bslen) ->- alloca $ \err -> do- to <- mallocBytes (bslen*2+1)- num <- c_PQescapeStringConn conn to from (fromIntegral bslen) err- stat <- peek err- case stat of- 0 -> do let i = fromIntegral num- tore <- reallocBytes to i- tofp <- newForeignPtr finalizerFree tore- return $ Just $ B.fromForeignPtr tofp 0 i- _ -> do free to- return Nothing+ withConn connection $ \conn ->+ B.unsafeUseAsCStringLen bs $ \(from, bslen) ->+ alloca $ \err -> do+ xs <- B.createAndTrim (bslen*2+1) $ \to ->+ fromIntegral `fmap`+ c_PQescapeStringConn conn to from (fromIntegral bslen) err+ stat <- peek err+ case stat of+ 0 -> return $ Just xs+ _ -> return Nothing -- | Escapes binary data for use within an SQL command with the type@@ -1446,7 +1444,6 @@ return $ Just $ B.fromForeignPtr tofp 0 ((fromIntegral l) - 1) - -- | Converts a 'ByteString' representation of binary data into binary -- data - the reverse of 'PQescapeByteaConn'. This is needed when -- retrieving bytea data in text format, but not when retrieving it in@@ -1553,7 +1550,7 @@ -- while waiting for data. getCopyData :: Connection -> Bool -> IO CopyOutResult getCopyData conn async = alloca $ \strp -> withConn conn $ \c -> do- len <- c_PQgetCopyData c strp (if async then 1 else 0)+ len <- c_PQgetCopyData c strp $! (fromIntegral (fromEnum async)) if len <= 0 then return $! case compare len (-1) of LT -> CopyOutError
postgresql-libpq.cabal view
@@ -1,5 +1,5 @@ Name: postgresql-libpq-Version: 0.8.2.2+Version: 0.8.2.3 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.2+ tag: v0.8.2.3