packages feed

postgresql-simple 0.4.7.0 → 0.4.8.0

raw patch · 4 files changed

+35/−2 lines, 4 filesdep +case-insensitive

Dependencies added: case-insensitive

Files

postgresql-simple.cabal view
@@ -1,5 +1,5 @@ Name:                postgresql-simple-Version:             0.4.7.0+Version:             0.4.8.0 Synopsis:            Mid-Level PostgreSQL client library Description:     Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -58,6 +58,7 @@     blaze-builder,     blaze-textual,     bytestring >= 0.9,+    case-insensitive,     containers,     hashable,     postgresql-libpq >= 0.9,@@ -81,7 +82,7 @@ source-repository this   type:     git   location: http://github.com/lpsmith/postgresql-simple-  tag:      v0.4.7.0+  tag:      v0.4.8.0  test-suite test   type:           exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/FromField.hs view
@@ -142,6 +142,8 @@ import qualified Data.Text as ST import qualified Data.Text.Encoding as ST import qualified Data.Text.Lazy as LT+import           Data.CaseInsensitive (CI)+import qualified Data.CaseInsensitive as CI import           Data.UUID   (UUID) import qualified Data.UUID as UUID import           Data.Scientific (Scientific)@@ -396,6 +398,28 @@ -- | name, text, \"char\", bpchar, varchar instance FromField LT.Text where     fromField f dat = LT.fromStrict <$> fromField f dat++-- | citext+instance FromField (CI ST.Text) where+    fromField f mdat = do+       typ <- typename f+       if typ /= "citext"+         then returnError Incompatible f ""+         else case mdat of+                Nothing  -> returnError UnexpectedNull f ""+                Just dat -> either left (pure . CI.mk)+                                        (ST.decodeUtf8' dat)++-- | citext+instance FromField (CI LT.Text) where+    fromField f mdat = do+       typ <- typename f+       if typ /= "citext"+         then returnError Incompatible f ""+         else case mdat of+                Nothing  -> returnError UnexpectedNull f ""+                Just dat -> either left (pure . CI.mk . LT.fromStrict)+                                        (ST.decodeUtf8' dat)  -- | name, text, \"char\", bpchar, varchar instance FromField [Char] where
src/Database/PostgreSQL/Simple/HStore.hs view
@@ -28,6 +28,7 @@      , toBuilder      , toLazyByteString      , hstore+     , parseHStoreList      , ToHStoreText(..)      , HStoreText      ) where
src/Database/PostgreSQL/Simple/HStore/Implementation.hs view
@@ -154,6 +154,13 @@     fromField f mdat = convert <$> fromField f mdat       where convert (HStoreList xs) = HStoreMap (Map.fromList xs) +parseHStoreList :: BS.ByteString -> Either String HStoreList+parseHStoreList dat =+    case P.parseOnly (parseHStore <* P.endOfInput) dat of+      Left err          -> Left (show err)+      Right (Left err)  -> Left (show err)+      Right (Right val) -> Right val+ parseHStore :: P.Parser (Either UnicodeException HStoreList) parseHStore = do     kvs <- P.sepBy' (skipWhiteSpace *> parseHStoreKeyVal)