X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FAutoRacingSchedule.hs;h=5a0344c91570b765cc46ea69bea63610fb1232bf;hb=bea741102a71b7cfa0a66e7dcb2cf7dc856905c2;hp=27b73ef44fc49a9630719844bba17e8e783aace0;hpb=d2f5d93b2b68f581d4cb4eabecc556c01762d370;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/AutoRacingSchedule.hs b/src/TSN/XML/AutoRacingSchedule.hs index 27b73ef..5a0344c 100644 --- a/src/TSN/XML/AutoRacingSchedule.hs +++ b/src/TSN/XML/AutoRacingSchedule.hs @@ -3,7 +3,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} @@ -13,6 +12,7 @@ -- containing \s. -- module TSN.XML.AutoRacingSchedule ( + dtd, pickle_message, -- * Tests auto_racing_schedule_tests, @@ -28,7 +28,7 @@ import Data.Time ( UTCTime(..) ) import Data.Tuple.Curry ( uncurryN ) import Database.Groundhog ( countAll, - executeRaw, + deleteAll, migrate, runMigration, silentMigrationLogger ) @@ -56,7 +56,7 @@ import Text.XML.HXT.Core ( import TSN.Codegen ( tsn_codegen_config ) import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) -import TSN.Picklers ( xp_date, xp_tba_time, xp_time_stamp ) +import TSN.Picklers ( xp_date_padded, xp_tba_time, xp_time_stamp ) import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) ) import Xml ( FromXml(..), @@ -67,6 +67,11 @@ import Xml ( unsafe_unpickle ) +-- | The DTD to which this module corresponds. Used to invoke dbimport. +-- +dtd :: String +dtd = "Auto_Racing_Schedule_XML.dtd" + -- -- DB/XML data types -- @@ -239,8 +244,7 @@ newtype AutoRacingScheduleListingRaceResult = deriving (Eq, Show) --- * AutoRacingScheduleListingRaceResultRaceResultListing / --- AutoRacingScheduleListingRaceResultRaceResultListingXml +-- * AutoRacingScheduleListingRaceResultRaceResultListing / AutoRacingScheduleListingRaceResultRaceResultListingXml -- -- Sorry about the names yo. -- @@ -414,7 +418,7 @@ pickle_listing = xpElem "Listing" $ xpWrap (from_tuple, to_tuple) $ xp10Tuple (xpElem "RaceID" xpInt) - (xpElem "Race_Date" xp_date) + (xpElem "Race_Date" xp_date_padded) (xpElem "Race_Time" xp_tba_time) (xpElem "RaceName" xpText) (xpElem "TrackName" xpText) @@ -549,8 +553,7 @@ test_on_delete_cascade = testGroup "cascading delete tests" migrate b migrate c _ <- dbimport sched - -- No idea how 'delete' works, so do this instead. - executeRaw False "DELETE FROM auto_racing_schedules;" [] + deleteAll a count_a <- countAll a count_b <- countAll b count_c <- countAll c