CorrelatedSubQuery

CorrelatedSubQuery

Correlated Sub-Query requires special lookups for every record in the primary table.

Constructor

new CorrelatedSubQuery(tableInfo, tableFields, bindData, defaultSubQuery)

Source:
Parameters:
Name Type Default Description
tableInfo Map.<String, Table>

Map of table info.

tableFields TableFields

Fields from all tables.

bindData BindData

List of bind data.

defaultSubQuery Object null

Select AST

Members

bindVariables

Source:
Properties:
Type Description
BindData

defaultSubQuery

Source:
Properties:
Type Description
Object

AST can be set here and skipped in select() statement.

tableFields

Source:
Properties:
Type Description
TableFields

Fields from all tables.

tableInfo

Source:
Properties:
Type Description
Map.<String, Table>

Map of table info.

Methods

replaceOuterFieldValueInCorrelatedWhere(calcSqlField, masterRecordID, tempAst, bindData)

Description:
  • If we find the field name in the AST, just replace with '?' and add to bind data variable list.

Source:
Parameters:
Name Type Description
calcSqlField CalculatedField

List of fields in outer query. If any are found in subquery, the value of that field for the current record is inserted into subquery before it is executed.

masterRecordID Number

current record number in outer query.

tempAst Object

AST for subquery. Any field names found from outer query will be replaced with bind place holder '?'.

bindData BindData

select(masterRecordID, calcSqlField, ast) → {Array.<Array.<any>>}

Description:
  • Perform SELECT on sub-query using data from current record in outer table.

Source:
Parameters:
Name Type Description
masterRecordID Number

Current record number in outer table.

calcSqlField CalculatedField

Calculated field object.

ast Object

Sub-query AST.

Returns:
  • double array of selected table data.
Type
Array.<Array.<any>>

traverseWhere(calcSqlField, terms, masterRecordID, bindData)

Description:
  • Search the WHERE portion of the subquery to find all references to the table in the outer query.

Source:
Parameters:
Name Type Description
calcSqlField CalculatedField

List of fields in outer query.

terms Object

terms of WHERE. It is modified with bind variable placeholders when outer table fields are located.

masterRecordID Number
bindData BindData