packages feed

sqlite-simple 0.4.17.0 → 0.4.18.0

raw patch · 14 files changed

+43/−38 lines, 14 filesdep ~semigroups

Dependency ranges changed: semigroups

Files

Database/SQLite/Simple.hs view
@@ -102,7 +102,6 @@   , Base.Error(..)   ) where -import           Control.Applicative import           Control.Exception import           Control.Monad (void, when, forM_) import           Control.Monad.Trans.Reader
Database/SQLite/Simple/FromField.hs view
@@ -34,7 +34,6 @@     , returnError     ) where -import           Control.Applicative (Applicative, (<$>), pure) import           Control.Exception (SomeException(..), Exception) import           Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as B@@ -44,7 +43,7 @@ import qualified Data.Text as T import qualified Data.Text.Lazy as LT import           Data.Typeable (Typeable, typeOf)-import           Data.Word (Word, Word8, Word16, Word32, Word64)+import           Data.Word (Word8, Word16, Word32, Word64) import           GHC.Float (double2Float)  import           Database.SQLite3 as Base
Database/SQLite/Simple/FromRow.hs view
@@ -24,7 +24,6 @@      , numFieldsRemaining      ) where -import           Control.Applicative (Applicative(..), (<$>)) import           Control.Exception (SomeException(..)) import           Control.Monad (replicateM) import           Control.Monad.Trans.State.Strict
Database/SQLite/Simple/Internal.hs view
@@ -19,8 +19,6 @@  module Database.SQLite.Simple.Internal where -import           Prelude hiding (catch)- import           Control.Exception (Exception) import           Control.Monad import           Control.Applicative
Database/SQLite/Simple/Ok.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP                #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor      #-} @@ -31,9 +32,13 @@  import Control.Applicative import Control.Exception-import Control.Monad(MonadPlus(..))+import Control.Monad (MonadPlus(..)) import Data.Typeable +#if !MIN_VERSION_base(4,13,0) && MIN_VERSION_base(4,9,0)+import Control.Monad.Fail+#endif+ -- FIXME:   [SomeException] should probably be something else,  maybe --          a difference list (or a tree?) @@ -72,7 +77,10 @@     Errors es >>= _ = Errors es     Ok a      >>= f = f a +#if MIN_VERSION_base(4,9,0)+instance MonadFail Ok where     fail str = Errors [SomeException (ErrorCall str)]+#endif  -- | a way to reify a list of exceptions into a single exception 
Database/SQLite/Simple/Time/Implementation.hs view
@@ -29,7 +29,6 @@ import           Data.ByteString.Internal (w2c) import           Data.Char (isDigit, ord) import           Data.Fixed (Pico)-import           Data.Monoid (Monoid(..)) import qualified Data.Text as T import           Data.Time hiding (getTimeZone, getZonedTime) import           Prelude hiding (take, (++))
Database/SQLite/Simple/ToField.hs view
@@ -26,7 +26,7 @@ import qualified Data.Text.Lazy as LT import qualified Data.Text.Encoding as T import           Data.Time (Day, UTCTime)-import           Data.Word (Word, Word8, Word16, Word32, Word64)+import           Data.Word (Word8, Word16, Word32, Word64) import           GHC.Float  import           Database.SQLite3 as Base
Database/SQLite/Simple/Types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, GeneralizedNewtypeDeriving, CPP #-}  ------------------------------------------------------------------------------ -- |@@ -24,12 +24,14 @@     ) where  import           Control.Arrow (first)-import           Data.Monoid (Monoid(..))-import           Data.Semigroup (Semigroup(..)) import           Data.String (IsString(..)) import           Data.Tuple.Only (Only(..)) import           Data.Typeable (Typeable) import qualified Data.Text as T++#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup+#endif  -- | A placeholder for the SQL @NULL@ value. data Null = Null
README.markdown view
@@ -1,6 +1,8 @@ sqlite-simple: mid-level bindings to the sqlite database ======================================================== +[![Build Status](https://secure.travis-ci.org/nurpax/sqlite-simple.png)](http://travis-ci.org/nurpax/sqlite-simple)+ This library is a mid-level Haskell binding to the SQLite database.  Sqlite-simple provides a convenient API to sqlite that does some level@@ -21,10 +23,8 @@ sqlite-simple performance against direct-sqlite, Python and C](http://nurpax.github.io/posts/2013-08-17-sqlite-simple-benchmarking.html). -[![Build Status](https://secure.travis-ci.org/nurpax/sqlite-simple.png)](http://travis-ci.org/nurpax/sqlite-simple) -Installation-------------+## Installation  You can install [sqlite-simple from Hackage](http://hackage.haskell.org/package/sqlite-simple) with:@@ -35,8 +35,7 @@  A Windows user?  It works but please see [this note](https://gist.github.com/3907344) on direct-sqlite Windows installation. -Examples of use----------------+## Examples of use  Create a test database by copy&pasting the below snippet to your shell:@@ -73,8 +72,7 @@ tests](https://github.com/nurpax/sqlite-simple/blob/master/test/Simple.hs).  -Development------------+## Development  The development roadmap for sqlite-simple is mostly captured in the github issue database.@@ -89,14 +87,15 @@ e-mail to the [database-devel mailing list](http://www.haskell.org/mailman/listinfo/database-devel). -### Contributing+## Contributing  If you send pull requests for new features, it'd be great if you could also develop unit tests for any such features. +## Credits -Credits--------+- [Janne Hellsten](https://github.com/nurpax) author, long-term maintainer+- [Sergey Bushnyak](https://github.com/sigrlami) current maintainer  A lot of the code is directly borrowed from [mysql-simple](http://github.com/bos/mysql-simple) by Bryan O'Sullivan
sqlite-simple.cabal view
@@ -1,5 +1,5 @@ Name:                sqlite-simple-Version:             0.4.17.0+Version:             0.4.18.0 Synopsis:            Mid-Level SQLite client library Description:     Mid-level SQLite client library, based on postgresql-simple.@@ -51,7 +51,7 @@     bytestring >= 0.9,     containers,     direct-sqlite >= 2.3.13 && < 2.4,-    semigroups == 0.18.*,+    semigroups >= 0.18 && < 0.20,     template-haskell,     text >= 0.11,     time,
test/Errors.hs view
@@ -11,7 +11,6 @@   , testErrorsExclusiveTransaction   ) where -import           Prelude hiding (catch) import           Control.Exception import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB@@ -22,7 +21,6 @@  import           Common import           Database.SQLite.Simple.Types (Null)-import           Database.SQLite3 (SQLError)  -- The "length (show e) `seq` .." trickery below is to force evaluate -- the contents of error messages.  Another option would be to log
test/ParamConv.hs view
@@ -1,5 +1,9 @@-{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables, OverloadedStrings, CPP #-} +#if MIN_VERSION_base(4,9,0)+{-# OPTIONS_GHC -Wno-overflowed-literals #-}+#endif+ module ParamConv (     testParamConvNull   , testParamConvInt@@ -13,7 +17,6 @@   , testParamConvComposite   , testParamNamed) where -import           Control.Applicative import           Data.Int import           Data.Word import           Data.Time@@ -133,10 +136,10 @@   -- TODO should _rows be forced to make sure parsers kick on the   -- returned data?   execute conn "INSERT INTO dt (t1,t2) VALUES (?,?)"-    (read "2012-08-12" :: Day, read "2012-08-12 01:01:01" :: UTCTime)+    (read "2012-08-12" :: Day, read "2012-08-12 01:01:01 UTC" :: UTCTime)   [_,(t1,t2)] <- query_ conn "SELECT t1,t2 from dt" :: IO [(Day, UTCTime)]   assertEqual "day" (read "2012-08-12" :: Day) t1-  assertEqual "day" (read "2012-08-12 01:01:01" :: UTCTime) t2+  assertEqual "day" (read "2012-08-12 01:01:01 UTC" :: UTCTime) t2   testParamConvBools :: TestEnv -> Test@@ -240,5 +243,3 @@   executeNamed conn "INSERT INTO np (b) VALUES (:b)" [":b" := True]   [Only t1] <- query_ conn "SELECT b FROM np"   True @=? t1--
test/Simple.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}  module Simple (@@ -20,13 +21,16 @@ import qualified Data.ByteString.Lazy as LBS -- orphan IsString instance in older byteString import           Data.ByteString.Lazy.Char8 ()-import           Data.Monoid ((<>), mappend, mempty) import qualified Data.Text as T import qualified Data.Text.Lazy as LT import           Data.Time (UTCTime, Day)  import           Common +#if !MIN_VERSION_base(4,11,0)+import Data.Monoid ((<>))+#endif+ -- Simplest SELECT testSimpleOnePlusOne :: TestEnv -> Test testSimpleOnePlusOne TestEnv{..} = TestCase $ do@@ -86,7 +90,7 @@ testSimpleTime :: TestEnv -> Test testSimpleTime TestEnv{..} = TestCase $ do   let timestr = "2012-08-20 20:19:58"-      time    = read timestr :: UTCTime+      time    = read (timestr ++ " UTC") :: UTCTime   execute_ conn "CREATE TABLE time (t TIMESTAMP)"   execute conn "INSERT INTO time (t) VALUES (?)" (Only time)   [Only t] <- query_ conn "SELECT * FROM time" :: IO [Only UTCTime]@@ -116,7 +120,7 @@ testSimpleTimeFract :: TestEnv -> Test testSimpleTimeFract TestEnv{..} = TestCase $ do   let timestr = "2012-08-17 08:00:03.256887"-      time    = read timestr :: UTCTime+      time    = read (timestr ++ " UTC") :: UTCTime   -- Try inserting timestamp directly as a string   execute_ conn "CREATE TABLE timefract (t TIMESTAMP)"   execute_ conn (Query (T.concat ["INSERT INTO timefract (t) VALUES ('", T.pack timestr, "')"]))@@ -177,7 +181,7 @@      makeReadable s =       let s' = if T.length s < T.length "YYYY-MM-DD HH:MM:SS" then T.append s ":00" else s-      in T.unpack . T.replace "T" " " $ s'+      in (T.unpack . T.replace "T" " " $ s') ++ " UTC"  testSimpleUTCTimeTZ :: TestEnv -> Test testSimpleUTCTimeTZ TestEnv{..} = TestCase $ do@@ -212,7 +216,7 @@   mapM_ assertResult times   where     assertResult tstr = do-      let utct = read . T.unpack $ tstr :: UTCTime+      let utct = read . (++ " UTC") . T.unpack $ tstr :: UTCTime       [Only t] <- query conn "SELECT ?" (Only utct) :: IO [Only T.Text]       assertEqual "UTCTime" tstr t 
test/TestImports.hs view
@@ -4,7 +4,6 @@   ) where  -- Test file to test that we can do most things with a single import-import           Control.Applicative import qualified Data.Text as T  import           Common