Laserfiche WebLink
Notes on the Use of Multiple Data Sources <br />All models are anticipated to be stand-alone, in the sense that the models will be able to take flat files <br />created by a DMI utility and run as if there were no CRDSS database. Because the CRDSS database <br />may not be populated with data on a schedule that is conducive to model development, there may be <br />a period where some of the ? CRDSS database? consists of flat files. The low-level routines will <br />evolve as these data are moved into the INFORMIX database. <br />Each of the low-level routines will have ESQL code that does the work. However, if the model <br />makes demands that cannot be easily handled with ESQL to the INFORMIX database, then the low- <br />level routines may have to seek data from a different source, e.g., flat files, ARC/INFO, etc. This <br />may be particularly important during development, when the final destination of data may not be in <br />place or may not even be known. Because models should not control the design of the entire system <br />(and all low-level routines), the way that the data source is indicated to low-level routines should be <br />clean. Several choices are available: <br />(1)Use a set of macros to define the data source, e.g.: <br />DMIGetStationLatLong ( ..., SOURCE_INFORMIX ); <br />DMIGetStationLatLong ( ..., FLAT_FILES ); <br />DMIGetStationLatLong ( ..., SOURCE_ARC_INFO ); <br />This option has the advantage that it is clean (no global/static variables to manage) and <br />provides a way to quickly change data sources. It has the disadvantage that an extra <br />argument may be needed in many calls, and a default value must be supplied. <br />(2)Use a global variable and set it with a utility routine, e.g.: <br />DMISetDataSource ( ..., SOURCE_INFORMIX ); <br />set a static (and possibly global) variable like data_source <br />to SOURCE_INFORMIX <br />DMIGetStationLatLong ( ... ); <br />data_source = DMIGetDataSource (); <br />if ( data_source == SOURCE_INFORMIX ) <br />/* get data using ESQL */ <br />else if ( data_source == SOURCE_ARC_INFO ) <br />/* get data from ARC/INFO */ <br />This option has the advantage that the data source can be changed quickly and does not <br />require that each routine specify this information. The data source would remain the same <br />between calls to the ?DMISetDataSource? routine. The other advantage is that the data <br />source variable would be hidden from the developer (one less thing to worry about). This <br />option may be desirable for development, where the developer would like to change data <br />sources as the data migrates from flat files to the INFORMIX database. <br />(3)Use a configuration file and/or environment variables, e.g.,: <br />DATASOURCE=INFORMIX <br />4 <br />A275 01.08.95 1.05-8 Malers <br />