persistent-postgresql 0.3.0 → 0.3.1
raw patch · 2 files changed
+17/−10 lines, 2 filesdep +textdep −utf8-stringdep ~persistent
Dependencies added: text
Dependencies removed: utf8-string
Dependency ranges changed: persistent
Files
Database/Persist/Postgresql.hs view
@@ -8,7 +8,7 @@ ) where import Database.Persist-import Database.Persist.Base+import Database.Persist.Base hiding (Add, Update) import Database.Persist.GenericSql import Database.Persist.GenericSql.Internal @@ -23,9 +23,13 @@ import Control.Arrow import Data.List (sort, groupBy) import Data.Function (on)-import qualified Data.ByteString.UTF8 as BSU import Control.Monad.Invert (MonadInvertIO) +import Data.ByteString (ByteString)+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Data.Text.Encoding.Error as T+ withPostgresqlPool :: MonadInvertIO m => String -> Int -- ^ number of connections to open@@ -181,7 +185,7 @@ case x of Nothing -> return $ front [] Just [PersistByteString con, PersistByteString col] ->- getAll pop (front . (:) (BSU.toString con, BSU.toString col))+ getAll pop (front . (:) (bsToChars con, bsToChars col)) Just _ -> getAll pop front -- FIXME error message? helperU pop = do rows <- getAll pop id@@ -230,12 +234,12 @@ case d' of Left s -> return $ Left s Right d'' ->- case getType $ BSU.toString z of+ case getType $ bsToChars z of Left s -> return $ Left s Right t -> do- let cname = RawName $ BSU.toString x+ let cname = RawName $ bsToChars x ref <- getRef cname- return $ Right $ Column cname (BSU.toString y == "YES")+ return $ Right $ Column cname (bsToChars y == "YES") t d'' ref where getRef cname = do@@ -256,7 +260,7 @@ return $ if i == 0 then Nothing else Just (RawName "", ref) d' = case d of PersistNull -> Right Nothing- PersistByteString a -> Right $ Just $ BSU.toString a+ PersistByteString a -> Right $ Just $ bsToChars a _ -> Left $ "Invalid default column: " ++ show d getType "int4" = Right $ SqlInt32 getType "int8" = Right $ SqlInteger@@ -441,3 +445,6 @@ go "" = "" go ('"':xs) = "\"\"" ++ go xs go (x:xs) = x : go xs++bsToChars :: ByteString -> String+bsToChars = T.unpack . T.decodeUtf8With T.lenientDecode
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 0.3.0+version: 0.3.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -18,11 +18,11 @@ HDBC >= 2.2.6 && < 2.3, transformers >= 0.2.1 && < 0.3, HDBC-postgresql >= 2.2.3.1 && < 2.3,- persistent >= 0.3.0 && < 0.4,+ persistent >= 0.3.1 && < 0.4, containers >= 0.2 && < 0.5, bytestring >= 0.9 && < 0.10, neither >= 0.1 && < 0.2,- utf8-string >= 0.3.6 && < 0.4+ text >= 0.7 && < 0.11 exposed-modules: Database.Persist.Postgresql ghc-options: -Wall