packages feed

HDBC-postgresql 2.0.0.0 → 2.1.0.0

raw patch · 4 files changed

+24/−17 lines, 4 filesdep ~HDBCdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: HDBC, base

API changes (from Hackage documentation)

Files

Database/HDBC/PostgreSQL.hs view
@@ -48,7 +48,7 @@  * SqlDiffTime: INTERVAL -* SqlPOSIXTime: INTEGER+* SqlPOSIXTime: NUMERIC  * SqlEpochTime: INTEGER 
Database/HDBC/PostgreSQL/Statement.hsc view
@@ -305,11 +305,7 @@              -- Dates and Date/Times       tid | tid == SqlDateT -> return $ SqlLocalDate (fromSql (toSql strval))-      tid | tid == SqlTimestampWithZoneT -> return $-              SqlZonedTime $ case parseTime defaultTimeLocale (iso8601DateFormat (Just "%T%z")) (strval ++ "00") of-                               Nothing -> error $ "PostgreSQL Statement.hsc: couldn't parse " ++-                                          strval ++ " as ZonedTime"-                               Just x -> x+      tid | tid == SqlTimestampWithZoneT -> return $ SqlZonedTime (fromSql (toSql (fixString strval)))            -- SqlUTCDateTimeT not actually generated by PostgreSQL                                             @@ -321,18 +317,18 @@             tid == SqlUTCTimeT   -> return $ SqlLocalTimeOfDay (fromSql (toSql strval))        tid | tid == SqlTimeWithZoneT -> -              (let (a, b) = case (parseTime defaultTimeLocale "%T%z" timestr,-                                  parseTime defaultTimeLocale "%T%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 = strval ++ "00"+                   timestr = fixString strval                in return $ SqlZonedLocalTimeOfDay a b) -      SqlIntervalT _ -> return $ SqlDiffTime $ fromInteger $ +      SqlIntervalT _ -> return $ SqlDiffTime $ fromRational $                           case split ':' strval of -                           [h, m, s] -> (read h) * 60 * 60 +-                                        (read m) * 60 +-                                        (read s)+                           [h, m, s] -> toRational (((read h)::Integer) * 60 * 60 ++                                                    ((read m)::Integer) * 60) ++                                        toRational ((read s)::Double)                            _ -> error $ "PostgreSQL Statement.hsc: Couldn't parse interval: " ++ strval              -- TODO: For now we just map the binary types to SqlByteStrings. New SqlValue constructors are needed to handle these.@@ -344,6 +340,16 @@        SqlUnknownT _ -> return $ SqlByteString bstrval +-- Convert "15:33:01.536+00" to "15:33:01.536 +0000"+fixString :: String -> String+fixString s =+    let (strbase, zone) = splitAt (length s - 3) s+    in+      if (head zone) == '-' || (head zone) == '+'+         then strbase ++ " " ++ zone ++ "00"+         else -- It wasn't in the expected format; don't touch.+              s+    -- Make a rational number from a decimal string representation of the number. makeRationalFromDecimal :: String -> Rational
Database/HDBC/PostgreSQL/Utils.hsc view
@@ -80,7 +80,6 @@                                                 fromSql y ++ "'") -}           convfunc y@(SqlUTCTime _) = convfunc (SqlZonedTime (fromSql y))-          convfunc y@(SqlPOSIXTime _) = convfunc (SqlInteger (fromSql y))           convfunc y@(SqlEpochTime _) = convfunc (SqlZonedTime (fromSql y))           convfunc x = cstrUtf8BString (fromSql x)           freefunc x =
HDBC-postgresql.cabal view
@@ -1,5 +1,5 @@ Name: HDBC-postgresql-Version: 2.0.0.0+Version: 2.1.0.0 License: LGPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen@@ -31,12 +31,14 @@     Database.HDBC.PostgreSQL.Parser,     Database.HDBC.PostgreSQL.PTypeConv   Extensions: ExistentialQuantification, ForeignFunctionInterface-  Build-Depends: base, mtl, HDBC>=2.0.0, parsec, utf8-string,+  Build-Depends: base, mtl, HDBC>=2.1.0, parsec, utf8-string,                  bytestring, old-time, old-locale   if flag(splitBase)-    Build-Depends: base >= 3 && < 4, old-time+    Build-Depends: base >= 3, old-time   else     Build-Depends: base < 3+  if impl(ghc >= 6.9)+    Build-Depends: base >= 4   Extra-Libraries: pq   C-Sources: hdbc-postgresql-helper.c   Include-Dirs: .