Description

Database Building Utility Functions

These functions can be used to:

  • create a new table based on a supplied Right Track Table Schema
  • load the table with the data from the specified source file
  • add a specified set of initial data to a table

Methods


<inner> init( db, table, agencyOptions, callback )

Description

Initialize the Table in the database. This will drop an existing table, create a new one (along with any specified indices and/or foreign key relationships) and import the data from the table's source file.

Parameters
Name Type Description
db object

SQLite Database being built

table RTTableSchema

The Right Track Table Schema

agencyOptions AgencyOptions

The Agency Build Options

callback buildTableCallback

Callback function called when init is finished


<inner> create( db, table, callback )

Description

Create the table in the database, along with indices and foreign keys

Parameters
Name Type Description
db object

SQLite Database being built

table RTTableSchema

The Right Track Table Schema

callback buildTableCallback

Callback function called when create is finished


<inner> load( db, table, agencyOptions, callback )

Description

Load the source file into the database

Parameters
Name Type Description
db object

SQLite database being built

table RTTableSchema

The Right Track Table Schema

agencyOptions AgencyOptions

Agency Build Options

callback buildTableCallback

Callback function called when load is finished


<inner> add( db, table, values, callback )

Description

Add the specified values into the table

Parameters
Name Type Description
db object

SQLite database being built

table RTTableSchema

The Right Track Table Schema

values Array.<object>

List of data to add to table. Each object is a set of data keypairs where the property name is the column header name and the value is the data value to add. Property names must match field names as specified in the RTTableSchema.

callback buildTableCallback

Callback function called when the data has been added