git.iko.soy/typeable/postgresql-simple
on master help sign in
Do not reverse key-value pairs in hstore parser.
commite7eb3d513af783692bf0f42cb83ab4fd1a6e7418 authorSimon Meier <simon.meier@erudify.ch> dateTue 30 Apr 2013, 00:00 (13 years ago) parentb03f685
3 files changed+8−8
CHANGES+3 postgresql-simple.cabal+1−1 src/Database/PostgreSQL/Simple/HStore/Implementation.hs+4−7
CHANGES+3
@@ -1,3 +1,6 @@
1+Version 0.3.1.2 (2013-04-29)
2+ * Fixed hstore parser to not unnecessarily reverse the key-value pairs
3+
14Version 0.3.1.1 (2013-04-29)
25 * Fixed hstore parser to recognize empty hstores
36
postgresql-simple.cabal+1−1
@@ -1,5 +1,5 @@
11Name: postgresql-simple
2−Version: 0.3.1.1
2+Version: 0.3.1.2
33Synopsis: Mid-Level PostgreSQL client library
44Description:
55 Mid-Level PostgreSQL client library, forked from mysql-simple.
src/Database/PostgreSQL/Simple/HStore/Implementation.hs+4−7
@@ -152,13 +152,10 @@ instance FromField HStoreMap where
152152 where convert (HStoreList xs) = HStoreMap (Map.fromList xs)
153153
154154parseHStore :: P.Parser (Either UnicodeException HStoreList)
155−parseHStore =
156− reverseEither [] <$> P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)
157− (skipWhiteSpace *> P.word8 (c2w ','))
158− where
159− reverseEither acc [] = Right (HStoreList acc)
160− reverseEither _acc ((Left err):_xs) = Left err
161− reverseEither acc ((Right x ):xs) = reverseEither (x:acc) xs
155+parseHStore = do
156+ kvs <- P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)
157+ (skipWhiteSpace *> P.word8 (c2w ','))
158+ return $ HStoreList <$> sequence kvs
162159
163160parseHStoreKeyVal :: P.Parser (Either UnicodeException (Text,Text))
164161parseHStoreKeyVal = do