Entering Data

[This is preliminary documentation and subject to change.]

The sample loader Load enters data into the database by using the method Handle in its application object. As mentioned in Getting Data to the Client, Load uses hard-coded values. Your loader should replace this function with one that loads the data you require.

Load creates objects, defined in the Dbsets library, for each record to add to the database, then uses the corresponding Guide data object to update the record. This is the recomended approach for manipulating the data in the guide database. Notice that several of the created objects require objects or identifiers from other objects. For example, when adding a channel you must supply the identifier of the station record. This requirement means that you must have a station record before you can create a channel record. The descriptions of the Guide database objects in the Guide Data Objects section indicate which methods require identifiers and which methods supply the required identifier.

Be careful when using dates and times. The database stores times in coordinated universal time (UTC). You must convert this to or from local time when appropriate. You can use the application member variable m_odtsTimeZoneAdjust to make the conversion.

While the Handle method is running, the loader is not receiving system messages.This means that if the system tries to shut down the loader, the loader is not informed and thus cannot terminate gracefully. Loading may stop while files are open or other system resources are in use. Such termination may have disastrous results.

To prevent this problem, your loader should call the function that pfnForceQuit points to within long processing loops to see if a shutdown message is in the message queue. If this function returns TRUE, your loader should perform whatever processing is required to safely terminate Handle. In Load and Download, the address for the function pfnForceQuit points to is stored in the application object's member variable m_pfnForceQuit.