@@ -108,9 +108,6 @@ module Database.PostgreSQL.Simple
108 -- * Helper functions
108 -- * Helper functions
109 , formatMany
109 , formatMany
110 , formatQuery
110 , formatQuery
116import Blaze.ByteString.Builder
113import Blaze.ByteString.Builder
@@ -289,26 +286,7 @@ parseTemplate template =
290 skipSpace = B.dropWhile isSpace_ascii
287 skipSpace = B.dropWhile isSpace_ascii
292−escapeStringConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
293−escapeStringConn = escapeWrap PQ.escapeStringConn
295−escapeIdentifier :: Connection -> ByteString -> IO (Either ByteString ByteString)
296−escapeIdentifier = escapeWrap PQ.escapeIdentifier
298−escapeByteaConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
299−escapeByteaConn = escapeWrap PQ.escapeByteaConn
301−escapeWrap :: (PQ.Connection -> ByteString -> IO (Maybe ByteString))
304− -> IO (Either ByteString ByteString)
305−escapeWrap f conn s =
306− withConnection conn $ \c ->
307− f c s >>= checkError c
309−checkError :: PQ.Connection -> Maybe a -> IO (Either ByteString a)
310−checkError _ (Just x) = return $ Right x
311−checkError c Nothing = Left . maybe "" id <$> PQ.errorMessage c
313buildQuery :: Connection -> Query -> ByteString -> [Action] -> IO Builder
291buildQuery :: Connection -> Query -> ByteString -> [Action] -> IO Builder
314buildQuery conn q template xs = zipParams (split template) <$> mapM sub xs
292buildQuery conn q template xs = zipParams (split template) <$> mapM sub xs