Methods
(static) addCalculatedPivotFieldsToAst(ast, pivotFieldData) → {Object}
- Description:
Add new calculated fields to the existing SELECT fields. A field is add for each combination of aggregate function and unqiue pivot data points. The CASE function is used for each new field. A test is made if the column data equal the pivot data. If it is, the aggregate function data is returned, otherwise null. The GROUP BY is later applied and the appropiate pivot data will be calculated.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ast |
Object | AST to be updated. |
pivotFieldData |
Array.<Array.<any>> | Table data with unique pivot field data points. |
Returns:
- Abstract Sytax Tree with new SELECT fields with a CASE for each pivot data and aggregate function.
- Type
- Object
(static) getUniquePivotData(ast) → {Array.<Array.<any>>}
Parameters:
Name | Type | Description |
---|---|---|
ast |
Object | Abstract Syntax Tree containing the PIVOT option. |
Returns:
- All unique data points found in the PIVOT field for the given SELECT.
- Type
- Array.<Array.<any>>
(static) pivotField(ast, tables, bindData) → {Object}
- Description:
Add new column to AST for every AGGREGATE function and unique pivot column data.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ast |
Object | AST which is checked to see if a PIVOT is used. |
tables |
Map.<String, Table> | Map of table info. |
bindData |
BindData | List of bind data. |
Returns:
- Updated AST containing SELECT FIELDS for the pivot data OR original AST if no pivot.
- Type
- Object