ERDBLoadTable of Contents

ERDB Table Load Utility ObjectIntroductionPublic MethodsAddFinishFinishAndLoadIgnoreLoadTablenewPutRelNameERDB Table Load Utility ObjectIntroductionThis object is designed to assist with creating the load file for an ERD data relation. The user constructs the object by specifying an ERDB objec and a relation name. This create the load file for the relevant relation. The clien then passes in data lines which are written to a file, and call Finish to close the file and get the statistics.

Public Methodsnewmy $erload = ERDBLoad->new($erdb, $relationName, $directory, $loadOnly, $ignore);

Begin loading an ERDB relation.

erdbERDB object representing the target database.

relationNameName of the relation being loaded.

directoryName of the directory to use for the load files, WITHOUT a trailing slash.

loadOnlyTRUE if the data is to be loaded from an existing file, FALSE if a file i to be created.

ignoreTRUE if the data is to be discarded. This is used to save time when onl a subset of the tables need to be loaded: the data for the ignored table is simply discarded.

Ignoremy $flag = $erload->Ignore;

Return TRUE if we are ignoring this table, else FALSE.

Putmy = $erload->Put($field1, $field2, ..., $fieldN);

Write a line of data to the load file.

field1, field2, ..., fieldNList of field values to be put into the data line. The field values must be in th order determined shown in the documentation for the table. Internal tabs an new-lines will automatically be escaped before the data line is formatted. The value for list fields should be list references.

If the first field value is a statistics object, the object will be used to generat a new internal key for the record being put.

Addmy = $stats->Add($statName, $value);

Increment the specified statistic.

statNameName of the statistic to increment.

value (optional)Value by which to increment it. If omitted, 1 is assumed.

Finishmy $stats = $erload->Finish();

Finish loading the table. This closes the load file.

RETURNReturns a statistics object describing what happened during the load and containing an error messages.

FinishAndLoadmy $stats = $erload->FinishAndLoad();

Finish the load and load the table, returning the statistics.

RelNamemy $name = $erload->RelName;

Name of the relation being loaded by this object.

LoadTablemy $stats = $erload->LoadTable();

Load the database table from the load file and return a statistics object.