postgresql-binary 0.12.1 → 0.12.1.1
raw patch · 3 files changed
+15/−12 lines, 3 filesdep −tasty-smallcheckdep ~QuickCheckdep ~tastydep ~tasty-hunit
Dependencies removed: tasty-smallcheck
Dependency ranges changed: QuickCheck, tasty, tasty-hunit, tasty-quickcheck
Files
- postgresql-binary.cabal +5/−6
- tasty/Main.hs +6/−1
- tasty/Main/DB.hs +4/−5
postgresql-binary.cabal view
@@ -1,7 +1,7 @@ name: postgresql-binary version:- 0.12.1+ 0.12.1.1 synopsis: Encoders and decoders for the PostgreSQL's binary format description:@@ -117,12 +117,11 @@ -- testing: postgresql-binary, postgresql-libpq == 0.9.*,- tasty == 0.11.*,- tasty-quickcheck == 0.8.*,- tasty-smallcheck == 0.8.*,- tasty-hunit == 0.9.*,+ tasty >= 1 && < 2,+ tasty-quickcheck >= 0.9 && < 0.11,+ tasty-hunit >= 0.9 && < 0.11, quickcheck-instances >= 0.3.11 && < 0.4,- QuickCheck >= 2.8.1 && < 2.10,+ QuickCheck >= 2.8.1 && < 3, -- data: aeson, json-ast == 0.3.*,
tasty/Main.hs view
@@ -5,7 +5,6 @@ import Test.QuickCheck.Instances import Test.Tasty import qualified Test.Tasty.HUnit as HUnit-import qualified Test.Tasty.SmallCheck as SmallCheck import qualified Test.Tasty.QuickCheck as QuickCheck import qualified Test.QuickCheck as QuickCheck import qualified PostgreSQL.Binary.Encoding as A@@ -36,6 +35,12 @@ else [] other = [+ select "select (234 :: int8)" (const B.int) (234 :: Int32)+ ,+ select "select (-234 :: int8)" (const B.int) (-234 :: Int32)+ ,+ select "select (0 :: int8)" (const B.int) (0 :: Int32)+ , let sql = "select (1, 'a')"
tasty/Main/DB.hs view
@@ -10,21 +10,20 @@ import Main.Prelude import Control.Monad.Trans.Reader-import Control.Monad.Trans.Either import Control.Monad.IO.Class import qualified Database.PostgreSQL.LibPQ as LibPQ import qualified Data.ByteString as ByteString; import Data.ByteString (ByteString) type Session =- EitherT ByteString (ReaderT LibPQ.Connection IO)+ ExceptT ByteString (ReaderT LibPQ.Connection IO) session :: Session a -> IO (Either ByteString a) session m = do c <- connect initConnection c- r <- runReaderT (runEitherT m) c+ r <- runReaderT (runExceptT m) c LibPQ.finish c return r @@ -42,13 +41,13 @@ result :: ByteString -> [Maybe (LibPQ.Oid, ByteString, LibPQ.Format)] -> LibPQ.Format -> Session (Maybe LibPQ.Result) result statement params outFormat = do- result <- EitherT $ ReaderT $ \connection -> fmap Right $ LibPQ.execParams connection statement params outFormat+ result <- ExceptT $ ReaderT $ \connection -> fmap Right $ LibPQ.execParams connection statement params outFormat checkResult result return result checkResult :: Maybe LibPQ.Result -> Session () checkResult result =- EitherT $ ReaderT $ \connection -> do+ ExceptT $ ReaderT $ \connection -> do case result of Just result -> do LibPQ.resultErrorField result LibPQ.DiagMessagePrimary >>= maybe (return (Right ())) (return . Left)