Skip to content
Browse files

Fix string escaping.

  • Loading branch information...
1 parent 373bf66 commit a6edaf7c8684815dc5d8a3f66d1d52e94c9c7ccd @chrisdone chrisdone committed
Showing with 4 additions and 2 deletions.
  1. +3 −1 Database/PostgreSQL/Base.hs
  2. +1 −1 pgsql-simple.cabal
View
4 Database/PostgreSQL/Base.hs
@@ -150,6 +150,7 @@ protocolVersion = 196608
-- | Escape a string for PostgreSQL.
escape :: String -> String
+escape ('\\':cs) = '\\' : '\\' : escape cs
escape ('\'':cs) = '\'' : '\'' : escape cs
escape (c:cs) = c : escape cs
escape [] = []
@@ -224,7 +225,8 @@ sendQuery types h sql = do
-- liftIO $ putStrLn $ show (typ,block)
let setStatus = modify $ \r -> r { resultType = typ }
case typ of
- ReadyForQuery -> return ()
+ ReadyForQuery ->
+ modify $ \r -> r { resultRows = reverse (resultRows r) }
listenPassively -> do
case listenPassively of
View
2 pgsql-simple.cabal
@@ -1,5 +1,5 @@
name: pgsql-simple
-version: 0.0.1
+version: 0.0.3
homepage: https://github.com/chrisdone/pgsql-simple
bug-reports: https://github.com/chrisdone/pgsql-simple/issues
synopsis: A mid-level PostgreSQL client library.

0 comments on commit a6edaf7

Please sign in to comment.
Something went wrong with that request. Please try again.