git.iko.soy/typeable/postgresql-simple
on master help sign in
Do not reverse key-value pairs in hstore parser.
e7eb3d5Simon Meier
@@ -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+
1Version 0.3.1.1 (2013-04-29)
4Version 0.3.1.1 (2013-04-29)
2 * Fixed hstore parser to recognize empty hstores
5 * Fixed hstore parser to recognize empty hstores
3
6
postgresql-simple.cabal+1−1
@@ -1,5 +1,5 @@
1Name: postgresql-simple
1Name: postgresql-simple
2−Version: 0.3.1.1
2+Version: 0.3.1.2
3Synopsis: Mid-Level PostgreSQL client library
3Synopsis: Mid-Level PostgreSQL client library
4Description:
4Description:
5 Mid-Level PostgreSQL client library, forked from mysql-simple.
5 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
152 where convert (HStoreList xs) = HStoreMap (Map.fromList xs)
152 where convert (HStoreList xs) = HStoreMap (Map.fromList xs)
153
153
154parseHStore :: P.Parser (Either UnicodeException HStoreList)
154parseHStore :: P.Parser (Either UnicodeException HStoreList)
155−parseHStore =
155+parseHStore = do
156− reverseEither [] <$> P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)
156+ kvs <- P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)
157− (skipWhiteSpace *> P.word8 (c2w ','))
157+ (skipWhiteSpace *> P.word8 (c2w ','))
158− where
158+ return $ HStoreList <$> sequence kvs
159− reverseEither acc [] = Right (HStoreList acc)
160− reverseEither _acc ((Left err):_xs) = Left err
161− reverseEither acc ((Right x ):xs) = reverseEither (x:acc) xs
162
159
163parseHStoreKeyVal :: P.Parser (Either UnicodeException (Text,Text))
160parseHStoreKeyVal :: P.Parser (Either UnicodeException (Text,Text))
164parseHStoreKeyVal = do
161parseHStoreKeyVal = do