SchemaSQLStatement Object

The SchemaSQLStatement Object holds information about a statement associated with a SchemaDataTable or SchemaCommand object. A statement contains the per connection or per connection type information about which query has to be executed when that data table is accessed. The schema can be accessed by using the relationships property.

The code snippet below shows how the object can be used:

for (i=0; i<schema.dataTables.count-1; i++)
{
  for (j=0; j<schema.dataTables[i].statements.count; j++)
  {
    log('schema.dataTables['+i+'].statements['+j+'].connection ='+schema.dataTables[i].statements[j].connection);
    log('schema.dataTables['+i+'].statements['+j+'].sql ='+schema.dataTables[i].statements[j].sql);
    log('schema.dataTables['+i+'].statements['+j+'].name ='+schema.dataTables[i].statements[j].name);
    log('schema.dataTables['+i+'].statements['+j+'].description ='+schema.dataTables[i].statements[j].description);
    log('schema.dataTables['+i+'].statements['+j+'].targetTable ='+schema.dataTables[i].statements[j].targetTable);
    log('schema.dataTables['+i+'].statements['+j+'].connectionType ='+schema.dataTables[i].statements[j].connectionType);
    log('schema.dataTables['+i+'].statements['+j+'].statementName ='+schema.dataTables[i].statements[j].statementName);
    log('schema.dataTables['+i+'].statements['+j+'].statementType ='+schema.dataTables[i].statements[j].statementType);
    log('schema.dataTables['+i+'].statements['+j+'].generatorName ='+schema.dataTables[i].statements[j].generatorName);
    log('schema.dataTables['+i+'].statements['+j+'].columnMappings.Count ='+schema.dataTables[i].statements[j].columnMappings.count);
   }
 }

Properties

connection

Represents the connection this statement belongs to; either this field or the connectionType has to be set for the statement to be found.

sql

Represents the SQL statement for this statement. Only works for the StatementType SQL. For StoredProc, this has to contain the name of the SP, for AutoSQL it is ignored.

name

Represents the (unique) name of the statement.

description

Represents the description for this statement.

targetTable

Represents the table to be used when applying updates, or, if the statement type is AutoSQL, it is used to generate the SQL for this query.

connectionType

Represents the connection type this property belongs to. Either this field or connection has to be set for the statement to be found for a given connection.

isDefault

If set, this is the default statement to use.

statementType

Value will be equal to SQL, AutoSQL or StoredProcedure.

columnMappings

Represents the array of SchemaColumnMapping Object instances and is used to map the fields returned from the Database Server back to the names used in the schema.