packages feed

HDBC-postgresql 2.3.2.2 → 2.3.2.3

raw patch · 7 files changed

+58/−17 lines, 7 filesdep ~basedep ~timenew-uploader

Dependency ranges changed: base, time

Files

+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# Changelog++#### 2.3.2.3++* Compatibility with time 1.5.+* Fix test compilation.+* Fix warnings.
Database/HDBC/PostgreSQL/Connection.hsc view
@@ -4,7 +4,7 @@ {-# LANGUAGE FlexibleContexts #-}  module Database.HDBC.PostgreSQL.Connection-	(connectPostgreSQL, withPostgreSQL,+        (connectPostgreSQL, withPostgreSQL,          connectPostgreSQL', withPostgreSQL',          Impl.begin, Impl.Connection())  where
Database/HDBC/PostgreSQL/Statement.hsc view
@@ -22,7 +22,9 @@ import Database.HDBC.DriverUtils import Database.HDBC.PostgreSQL.PTypeConv import Data.Time.Format+#ifndef MIN_TIME_15 import System.Locale+#endif  l :: Monad m => t -> m () l _ = return ()@@ -333,8 +335,8 @@             tid == SqlUTCTimeT   -> return $ SqlLocalTimeOfDay (fromSql (toSql strval))        tid | tid == SqlTimeWithZoneT ->-              (let (a, b) = case (parseTime defaultTimeLocale "%T%Q %z" timestr,-                                  parseTime defaultTimeLocale "%T%Q %z" timestr) of+              (let (a, b) = case (parseTime' defaultTimeLocale "%T%Q %z" timestr,+                                  parseTime' defaultTimeLocale "%T%Q %z" timestr) of                                 (Just x, Just y) -> (x, y)                                 x -> error $ "PostgreSQL Statement.hsc: Couldn't parse " ++ strval ++ " as SqlZonedLocalTimeOfDay: " ++ show x                    timestr = fixString strval@@ -383,3 +385,10 @@ split :: Char -> String -> [String] split delim inp =     lines . map (\x -> if x == delim then '\n' else x) $ inp++parseTime' :: ParseTime t => TimeLocale -> String -> String -> Maybe t+#if MIN_TIME_15+parseTime' = parseTimeM True+#else+parseTime' = parseTime+#endif
HDBC-postgresql.cabal view
@@ -1,5 +1,5 @@ Name: HDBC-postgresql-Version: 2.3.2.2+Version: 2.3.2.3 License: BSD3 Maintainer: Nicolas Wu <nicolas.wu@gmail.com> Author: John Goerzen@@ -9,6 +9,7 @@                     Makefile,                     README.txt,                     testsrc/TestTime.hs+                    CHANGELOG.md homepage: http://github.com/hdbc/hdbc-postgresql Category: Database synopsis: PostgreSQL driver for HDBC@@ -23,6 +24,9 @@ Flag buildtests   description: Build the executable to run unit tests   default: False+Flag minTime15+  description: Use time 1.5 or higher.+  default: True  Library   Exposed-Modules: Database.HDBC.PostgreSQL@@ -36,7 +40,12 @@     Database.HDBC.PostgreSQL.ErrorCodes   Extensions: ExistentialQuantification, ForeignFunctionInterface   Build-Depends: base >= 3 && < 5, mtl, HDBC>=2.2.0, parsec, utf8-string,-                 bytestring, old-time, old-locale, time, convertible+                 bytestring, old-time, convertible+  if flag(minTime15)+    Build-Depends: time >= 1.5 && < 1.6+    CPP-Options: -DMIN_TIME_15+  else+    Build-Depends: time < 1.5, old-locale   if impl(ghc >= 6.9)     Build-Depends: base >= 4   Extra-Libraries: pq@@ -48,8 +57,13 @@    if flag(buildtests)       Buildable: True       Build-Depends: HUnit, QuickCheck, testpack, containers,-                     convertible, time, old-locale, parsec, utf8-string,-                     bytestring, old-time, base, HDBC>=2.2.6+                     convertible, parsec, utf8-string,+                     bytestring, old-time, base >= 4.6 && < 4.9, HDBC>=2.2.6+      if flag(minTime15)+        Build-Depends: time >= 1.5 && < 1.6+        CPP-Options: -DMIN_TIME_15+      else+        Build-Depends: time < 1.5, old-locale    else       Buildable: False    Main-Is: runtests.hs
testsrc/TestSbasics.hs view
@@ -4,7 +4,7 @@ import Database.HDBC import TestUtils import System.IO-import Control.Exception hiding (catch)+import Control.Exception  openClosedb = sqlTestCase $      do dbh <- connectDB@@ -142,7 +142,7 @@        -- Let's try a rollback.        catch (withTransaction dbh (\_ -> do sExecuteMany sth rows                                             fail "Foo"))-             (\_ -> return ())+             (\SomeException{} -> return ())        sExecute qrysth []        sFetchAllRows qrysth >>= (assertEqual "rollback" [[Just "0"]]) 
testsrc/TestTime.hs view
@@ -1,17 +1,22 @@-{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleContexts, CPP #-}  module TestTime(tests) where import Test.HUnit import Database.HDBC import TestUtils import Control.Exception-import Data.Time+import Data.Time (UTCTime, Day, NominalDiffTime) import Data.Time.LocalTime import Data.Time.Clock.POSIX import Data.Maybe import Data.Convertible import SpecificDB+#ifdef MIN_TIME_15+import Data.Time (parseTimeM, defaultTimeLocale)+#else+import Data.Time (parseTime) import System.Locale(defaultTimeLocale)+#endif import Database.HDBC.Locale (iso8601DateFormat) import qualified System.Time as ST @@ -19,11 +24,11 @@     a == b = zonedTimeToUTC a == zonedTimeToUTC b  testZonedTime :: ZonedTime-testZonedTime = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T %z"))+testZonedTime = fromJust $ parseTime' defaultTimeLocale (iso8601DateFormat (Just "%T %z"))                  "1989-08-01 15:33:01 -0500"  testZonedTimeFrac :: ZonedTime-testZonedTimeFrac = fromJust $ parseTime defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z"))+testZonedTimeFrac = fromJust $ parseTime' defaultTimeLocale (iso8601DateFormat (Just "%T%Q %z"))                     "1989-08-01 15:33:01.536 -0500"  @@ -35,8 +40,8 @@     -> (a -> b)     -> Test testDTType inputdata convToSqlValue toComparable = dbTestCase $ \dbh ->-    do run dbh ("CREATE TABLE hdbctesttime (testid INTEGER PRIMARY KEY NOT NULL, \-                \testvalue " ++ dateTimeTypeOfSqlValue value ++ ")") []+    do run dbh ("CREATE TABLE hdbctesttime (testid INTEGER PRIMARY KEY NOT NULL, testvalue " ++ dateTimeTypeOfSqlValue value ++ ")") []+       commit dbh        finally (testIt dbh) (do commit dbh                                 run dbh "DROP TABLE hdbctesttime" []                                 commit dbh@@ -106,3 +111,9 @@        baseCalendarTime :: ST.CalendarTime       baseCalendarTime = convert testZonedTime++#if MIN_TIME_15+parseTime' = parseTimeM True+#else+parseTime' = parseTime+#endif
testsrc/Testbasics.hs view
@@ -3,7 +3,7 @@ import Database.HDBC import TestUtils import System.IO-import Control.Exception hiding (catch)+import Control.Exception  openClosedb = sqlTestCase $      do dbh <- connectDB@@ -140,7 +140,7 @@        -- Let's try a rollback.        catch (withTransaction dbh (\_ -> do executeMany sth rows                                             fail "Foo"))-             (\_ -> return ())+             (\SomeException{} -> return ())        execute qrysth []        fetchAllRows qrysth >>= (assertEqual "rollback" [[SqlString "0"]])