@@ -108,9 +108,6 @@ module Database.PostgreSQL.Simple
108108 -- * Helper functions
109109 , formatMany
110110 , formatQuery
111− , escapeStringConn
112− , escapeIdentifier
113− , escapeByteaConn
114111 ) where
115112
116113import Blaze.ByteString.Builder
@@ -289,26 +286,7 @@ parseTemplate template =
289286
290287 skipSpace = B.dropWhile isSpace_ascii
291288
292−escapeStringConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
293−escapeStringConn = escapeWrap PQ.escapeStringConn
294289
295−escapeIdentifier :: Connection -> ByteString -> IO (Either ByteString ByteString)
296−escapeIdentifier = escapeWrap PQ.escapeIdentifier
297−
298−escapeByteaConn :: Connection -> ByteString -> IO (Either ByteString ByteString)
299−escapeByteaConn = escapeWrap PQ.escapeByteaConn
300−
301−escapeWrap :: (PQ.Connection -> ByteString -> IO (Maybe ByteString))
302− -> Connection
303− -> ByteString
304− -> IO (Either ByteString ByteString)
305−escapeWrap f conn s =
306− withConnection conn $ \c ->
307− f c s >>= checkError c
308−
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
312290
313291buildQuery :: Connection -> Query -> ByteString -> [Action] -> IO Builder
314292buildQuery conn q template xs = zipParams (split template) <$> mapM sub xs