packages feed

postgresql-simple 0.3.1.0 → 0.3.1.1

raw patch · 4 files changed

+13/−17 lines, 4 filesdep ~attoparsec

Dependency ranges changed: attoparsec

Files

CONTRIBUTORS view
@@ -9,3 +9,4 @@ Jason Dusek <jason.dusek@gmail.com> Jeff Chu <jeff@kiteedu.com> Oliver Charles <oliver.g.charles@gmail.com>+Simon Meier <iridcode@gmail.com>
postgresql-simple.cabal view
@@ -1,5 +1,5 @@ Name:                postgresql-simple-Version:             0.3.1.0+Version:             0.3.1.1 Synopsis:            Mid-Level PostgreSQL client library Description:     Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -50,7 +50,7 @@      Database.PostgreSQL.Simple.TypeInfo.Types    Build-depends:-    attoparsec >= 0.8.5.3,+    attoparsec >= 0.10.3,     base < 5,     blaze-builder,     blaze-textual,@@ -75,7 +75,7 @@ source-repository this   type:     git   location: http://github.com/lpsmith/postgresql-simple-  tag:      v0.3.1.0+  tag:      v0.3.1.1  test-suite test   type:           exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/HStore/Implementation.hs view
@@ -129,7 +129,7 @@         else case mdat of                Nothing  -> returnError UnexpectedNull f ""                Just dat ->-                   case P.parseOnly parseHStore dat of+                   case P.parseOnly (parseHStore <* P.endOfInput) dat of                      Left err ->                          returnError ConversionFailed f err                      Right (Left err) ->@@ -152,19 +152,13 @@       where convert (HStoreList xs) = HStoreMap (Map.fromList xs)  parseHStore :: P.Parser (Either UnicodeException HStoreList)-parseHStore = skipWhiteSpace >> loop id+parseHStore =+    reverseEither [] <$> P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)+                                  (skipWhiteSpace *> P.word8 (c2w ','))   where-    loop acc = do-      mkv <- parseHStoreKeyVal-      case mkv of-        Left err -> return (Left err)-        Right kv -> do-           skipWhiteSpace-           (do-              _ <- P.word8 (c2w ',')-              skipWhiteSpace-              loop (acc . (kv:))-            ) <|> return (Right (HStoreList (acc [kv])))+    reverseEither acc []                = Right (HStoreList acc)+    reverseEither _acc ((Left err):_xs) = Left err+    reverseEither acc ((Right x ):xs)   = reverseEither (x:acc) xs  parseHStoreKeyVal :: P.Parser (Either UnicodeException (Text,Text)) parseHStoreKeyVal = do@@ -199,7 +193,7 @@ parseHStoreTexts acc = do   mchunk <- TS.decodeUtf8' <$> P.takeWhile (not . isSpecialChar)   case mchunk of-    Left err -> return (Left err)+    Left err    -> return (Left err)     Right chunk ->         (do           _ <- P.word8 (c2w '\\')
test/Main.hs view
@@ -108,6 +108,7 @@  testHStore :: TestEnv -> Test testHStore TestEnv{..} = TestCase $ do+    roundTrip []     roundTrip [("foo","bar"),("bar","baz"),("baz","hello")]     roundTrip [("fo\"o","bar"),("b\\ar","baz"),("baz","\"value\\with\"escapes")]   where