mysql-simple 0.4.0.0 → 0.4.0.1
raw patch · 5 files changed
+41/−6 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Database/MySQL/Simple/Result.hs +6/−3
- mysql-simple.cabal +1/−1
- stack.yaml +1/−1
- test/main.hs +29/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.4.0.1++* Fix https://github.com/paul-rouse/mysql-simple/issues/35+ ## 0.4.0.0 * Add type VaArgs for non-parenthesized variable-length list of parameters.
Database/MySQL/Simple/Result.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances #-}+{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, OverloadedStrings #-} #if MIN_VERSION_time(1,5,0) {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} #endif@@ -38,7 +38,7 @@ import Data.List (foldl') import Data.Ratio (Ratio) import Data.Time.Calendar (Day, fromGregorian)-import Data.Time.Clock (UTCTime)+import Data.Time.Clock (UTCTime(..)) import Data.Time.Format (parseTime) import Data.Time.LocalTime (TimeOfDay, makeTimeOfDayValid) import Data.Typeable (TypeRep, Typeable, typeOf)@@ -164,7 +164,10 @@ convert f = doConvert f ok $ \bs -> case parseTime defaultTimeLocale "%F %T" (B8.unpack bs) of Just t -> t- Nothing -> conversionFailed f "UTCTime" "could not parse"+ Nothing+ | SB.isPrefixOf "0000-00-00" bs ->+ UTCTime (fromGregorian 0 0 0) 0+ | otherwise -> conversionFailed f "UTCTime" "could not parse" where ok = mkCompats [DateTime,Timestamp] instance Result Day where
mysql-simple.cabal view
@@ -1,5 +1,5 @@ name: mysql-simple-version: 0.4.0.0+version: 0.4.0.1 homepage: https://github.com/paul-rouse/mysql-simple bug-reports: https://github.com/paul-rouse/mysql-simple/issues synopsis: A mid-level MySQL client library.
stack.yaml view
@@ -4,4 +4,4 @@ packages: - '.' extra-deps: []-resolver: lts-6.23+resolver: lts-6.25
test/main.hs view
@@ -4,7 +4,9 @@ import Database.MySQL.Simple (ConnectInfo (..), defaultConnectInfo, connect, close, query_, Only (..))+import System.Exit (exitFailure) import Test.Hspec+import TestOpts (dbtests) -- This is how to connect to our test database testConn :: ConnectInfo@@ -14,13 +16,39 @@ connectDatabase = "test" } +advice :: String+advice =+ "\n\+ \Database test not run for mysql-simple\n\+ \======================================\n\+ \\n\+ \To run the tests properly, you need to specify the flag 'dbtests' when\n\+ \building the test, for example either of these commands will do it:\n\+ \\n\+ \ stack test --flag mysql-simple:dbtests\n\+ \ cabal configure --enable-tests --flags=dbtests && cabal test\n\+ \\n\+ \You also need to set up a MySQL database which the test can use via\n\+ \these connection parameters:\n\+ \\n\+ \ Host \"127.0.0.1\"\n\+ \ Port 3306\n\+ \ User \"test\"\n\+ \ Password \"\"\n\+ \ Database \"test\"\n\+ \\n"+ + -- Only the most cursory test is done at the moment, simply showing that -- things hang together sufficiently well that we can talk to the database -- server. -- main :: IO ()-main = bracket (connect testConn) close $ \conn -> hspec $ do+main = if dbtests then bracket (connect testConn) close $ \conn -> hspec $ do describe "Database" $ do it "seems to be connected" $ do result <- query_ conn "select 1 + 1" result `shouldBe` [Only (2::Int)]+ else do+ putStr advice+ exitFailure