packages feed

HDBC 2.1.0 → 2.1.1

raw patch · 5 files changed

+93/−6 lines, 5 filesdep ~timePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: time

API changes (from Hackage documentation)

- Database.HDBC.SqlValue: instance Typeable Day
- Database.HDBC.SqlValue: instance Typeable DiffTime
- Database.HDBC.SqlValue: instance Typeable LocalTime
- Database.HDBC.SqlValue: instance Typeable TimeOfDay
- Database.HDBC.SqlValue: instance Typeable TimeZone
- Database.HDBC.SqlValue: instance Typeable ZonedTime

Files

Database/HDBC/SqlValue.hs view
@@ -582,6 +582,9 @@     safeConvert (SqlTimeDiff x) = return . fromIntegral $ x     safeConvert y@(SqlNull) = quickError y +#if __GLASGOW_HASKELL__ >= 610+-- instances added in GHC 6.10.3+#else instance Typeable Day where     typeOf _ = mkTypeName "Day" instance Typeable TimeOfDay where@@ -590,14 +593,16 @@     typeOf _ = mkTypeName "LocalTime" instance Typeable ZonedTime where     typeOf _ = mkTypeName "ZonedTime"-instance Typeable ST.ClockTime where-    typeOf _ = mkTypeName "ClockTime"-instance Typeable ST.TimeDiff where-    typeOf _ = mkTypeName "TimeDiff" instance Typeable DiffTime where     typeOf _ = mkTypeName "DiffTime" instance Typeable TimeZone where     typeOf _ = mkTypeName "TimeZone"+#endif++instance Typeable ST.ClockTime where+    typeOf _ = mkTypeName "ClockTime"+instance Typeable ST.TimeDiff where+    typeOf _ = mkTypeName "TimeDiff"  instance Convertible Day SqlValue where     safeConvert = return . SqlLocalDate
HDBC.cabal view
@@ -1,5 +1,5 @@ Name: HDBC-Version: 2.1.0+Version: 2.1.1 License: LGPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -26,7 +26,7 @@  library   if flag(splitBase)-    Build-Depends: base>=3, old-time, time, bytestring, containers, old-locale+    Build-Depends: base>=3, old-time, time>=1.1.2.4, bytestring, containers, old-locale   else     Build-Depends: base<3   Build-Depends: mtl, convertible >= 1.0.1, utf8-string
+ testsrc/TestInfrastructure.hs view
@@ -0,0 +1,17 @@+{-+Copyright (C) 2009 John Goerzen <jgoerzen@complete.org>++All rights reserved.++For license and copyright information, see the file COPYRIGHT+-}+module TestInfrastructure where+import qualified Test.QuickCheck as QC+import qualified Test.HUnit as HU+import Test.HUnit.Tools++q :: QC.Testable a => String -> a -> HU.Test+q = qc2hu 250++qverbose :: QC.Testable a => String -> a -> HU.Test+qverbose = qc2huVerbose 250
+ testsrc/TestSqlValue.hs view
@@ -0,0 +1,51 @@+{-+Copyright (C) 2009 John Goerzen <jgoerzen@complete.org>++All rights reserved.++For license and copyright information, see the file COPYRIGHT+-}++module TestSqlValue where+import TestInfrastructure+import Test.QuickCheck+import Test.QuickCheck.Tools+import qualified Test.HUnit as HU+import Database.HDBC+import Data.Time.Format+import Data.Time.LocalTime+import System.Locale+import Data.Maybe++instance Eq ZonedTime where+    a == b = zonedTimeToUTC a == zonedTimeToUTC b &&+             zonedTimeZone a == zonedTimeZone b++toSql_Int :: Int -> Result+toSql_Int x = toSql x @?= SqlInt32 (fromIntegral x)++fromSql_Int :: Int -> Result+fromSql_Int x = +    Right x @=? safeFromSql (SqlInt32 (fromIntegral x))++testZonedTimeStr = "1989-08-01 15:33:01 -0500"+testZonedTime :: ZonedTime+testZonedTime = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T %z"))+                testZonedTimeStr++testZonedTimeFracStr = "1989-08-01 15:33:01.536 -0500"+testZonedTimeFrac :: ZonedTime+testZonedTimeFrac = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z"))+                    testZonedTimeFracStr++ztparsenf =+    (HU.@=?) testZonedTime (fromSql (SqlString testZonedTimeStr))+ztparsef =+    (HU.@=?) testZonedTimeFrac (fromSql (SqlString testZonedTimeFracStr))++hut msg = HU.TestLabel msg . HU.TestCase++allt = [q "toSql Int" toSql_Int,+        q "safeFromSql Int" fromSql_Int,+        hut "non-frac parse" ztparsenf,+        hut "frac parse" ztparsef]
+ testsrc/runtests.hs view
@@ -0,0 +1,14 @@+module Main where+import qualified Test.HUnit as HU+import Test.HUnit.Tools++import qualified TestSqlValue++test1 = HU.TestCase ((HU.@=?) "x" "x")++alltests = [HU.TestLabel "test1" test1,+            tl "TestSqlValue" TestSqlValue.allt+           ]++main = do runVerboseTests (HU.TestList alltests)+          return ()