packages feed

postgresql-simple 0.5.0.0 → 0.5.0.1

raw patch · 3 files changed

+18/−10 lines, 3 files

Files

postgresql-simple.cabal view
@@ -1,5 +1,5 @@ Name:                postgresql-simple-Version:             0.5.0.0+Version:             0.5.0.1 Synopsis:            Mid-Level PostgreSQL client library Description:     Mid-Level PostgreSQL client library, forked from mysql-simple.@@ -83,7 +83,7 @@ source-repository this   type:     git   location: http://github.com/lpsmith/postgresql-simple-  tag:      v0.5.0.0+  tag:      v0.5.0.1  test-suite test   type:           exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/Time/Internal/Printer.hs view
@@ -102,7 +102,7 @@      tzh = f >$< (char8 >*< digits2) -    tzm = condB (==0) emptyB ((,) ':' >$< liftB (char8 >*< digits2))+    tzm = condB (==0) emptyB ((,) ':' . abs >$< liftB (char8 >*< digits2))  utcTime :: BoundedPrim UTCTime utcTime = f >$< (day >*< liftB char8 >*< timeOfDay >*< liftB char8)
test/Time.hs view
@@ -47,15 +47,15 @@ testTime env@TestEnv{..} = TestCase $ do   initializeTable env   execute_ conn "SET timezone TO 'UTC'"-  checkRoundTrips env+  checkRoundTrips env "1860-01-01 00:00:00+00"   execute_ conn "SET timezone TO 'America/Chicago'"   -- -5:00-  checkRoundTrips env+  checkRoundTrips env "1883-11-18 12:00:00-06"   execute_ conn "SET timezone TO 'Asia/Tokyo'"        -- +9:00-  checkRoundTrips env+  checkRoundTrips env "1888-01-01 00:00:00+09"   execute_ conn "SET timezone TO 'Asia/Kathmandu'"    -- +5:45-  checkRoundTrips env+  checkRoundTrips env "1919-12-31 23:48:44+05:30"   execute_ conn "SET timezone TO 'America/St_Johns'"  -- -3:30-  checkRoundTrips env+  checkRoundTrips env "1935-03-30 00:00:52-03:30"  initializeTable :: TestEnv -> IO () initializeTable TestEnv{..} = withTransaction conn $ do@@ -102,10 +102,18 @@   pop "100 milliseconds" 6.3113904e10   pop   "1 second"       6.3113904e9 -checkRoundTrips :: TestEnv -> IO ()-checkRoundTrips TestEnv{..} = do+checkRoundTrips :: TestEnv -> ByteString -> IO ()+checkRoundTrips TestEnv{..} limit = do   yxs :: [(UTCTime, Int)] <- query_ conn [sql| SELECT y, x FROM testtime |]   forM_ yxs $ \yx -> do       res <- query conn [sql| SELECT y=? FROM testtime WHERE x=? |] yx       assertBool "UTCTime did not round-trip from SQL to Haskell and back" $+                 res == [Only True]++  yxs :: [(ZonedTime, Int)] <- query conn [sql| +              SELECT y, x FROM testtime WHERE y > ? +           |] (Only limit)+  forM_ yxs $ \yx -> do+      res <- query conn [sql| SELECT y=? FROM testtime WHERE x=? |] yx+      assertBool "ZonedTime did not round-trip from SQL to Haskell and back" $                  res == [Only True]