EntitySchemaQuery class
The EntitySchemaQuery
class builds queries to select records in a database.
Methods
abortQuery()
Aborts the query.
addAggregationSchemaColumn(columnPath, aggregationType, [columnAlias], aggregationEvalType)
Creates an instance of the Terrasoft.FunctionQueryColumn
function column with the specified AGGREGATION
type. Adds the instance to the query column collection.
Parameters
{String} columnPath | The path to the column to add, relative to | ||||||||
{Terrasoft.AggregationType} aggregationType | The aggregate function type. Available values (Terrasoft.AggregationType)
| ||||||||
{String} columnAlias | The column alias. Optional. | ||||||||
{Terrasoft.AggregationEvalType} aggregationEvalType | The aggregate function scope. Available values (Terrasoft.AggregationEvalType)
|
addColumn(column, [columnAlias], [config])
Creates an instance of the Terrasoft.EntityQueryColumn
column. Adds the instance to the query column collection.
Parameters
{String/Terrasoft.BaseQueryColumn} column | The path to the column to add (relative to |
{String} columnAlias | The column alias. Optional. |
config | The configuration object of the query column. |
addDatePartFunctionColumn(columnPath, datePartType, [columnAlias])
Creates an instance of the Terrasoft.FunctionQueryColumn
function column with the DATE_PART
type. Adds the instance to the query column collection.
Parameters
{String/Terrasoft.BaseQueryColumn} column | The path to the column to add (relative to |
{String} columnAlias | The column alias. Optional. |
{Object} config | The configuration object of the query column. |
addDatePeriodMacrosColumn(macrosType, [macrosValue], [columnAlias])
Creates an instance of the Terrasoft.FunctionQueryColumn
function column with the MACROS
type that must be parameterized. Adds the instance to the query column collection. For example, the following N days, the third quarter of the year, etc.
Parameters
{String} columnPath | The path to the column to add, relative to | ||||||||||||||||
{Terrasoft.DatePartType} datePartType | The date part to use as the value. Available values (Terrasoft.DatePartType)
| ||||||||||||||||
{String} columnAlias | The column alias. Optional. |
addFunctionColumn(columnPath, functionType, [columnAlias])
Creates an instance of the Terrasoft.FunctionQueryColumn
function column. Adds the instance to the query column collection.
Parameters
{String} columnPath | The path to the column to add, relative to | ||||||||||
{Terrasoft.FunctionType} functionType | The function type. Available values (Terrasoft.FunctionType)
| ||||||||||
{String} columnAlias | The column alias. Optional. |
addMacrosColumn(macrosType, [columnAlias])
Creates an instance of the Terrasoft.FunctionQueryColumn
function column with the MACROS
type that does not need to be parameterized. For example, current month, current user, primary column, etc. Adds the instance to the query column collection.
Parameters
{Terrasoft.QueryMacrosType} macrosType | The column macro type. Available values (Terrasoft.QueryMacrosType)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{String} columnAlias | The column alias. Optional. |
addParameterColumn(paramValue, paramDataType, [columnAlias])
Creates an instance of the Terrasoft.ParameterQueryColumn
parameter column. Adds the instance to the query column collection.
Parameters
{Mixed} paramValue | The parameter value. Must correspond to the data type. |
{Terrasoft.DataValueType} paramDataType | The parameter data type. |
{String} columnAlias | The column alias. Optional. |
createBetweenFilter(leftExpression, rightLessExpression, rightGreaterExpression)
Creates a Between
filter instance.
Parameters
{Terrasoft.BaseExpression} leftExpression | The expression to check in the filter. |
{Terrasoft.BaseExpression} rightLessExpression | The initial expression of the filtering scope. |
{Terrasoft.BaseExpression} rightGreaterExpression | The final expression of the filtering scope. |
createColumnBetweenFilterWithParameters(columnPath, lessParamValue, greaterParamValue, paramDataType)
Creates a Between
filter instance to check if the column is within the specified scope.
Parameters
{String} columnPath | The path to the check column, relative to the |
{Mixed} lessParamValue | The initial value of the filter. |
{Mixed} greaterParamValue | The final value of the filter. |
{Terrasoft.DataValueType} paramDataType | The parameter data type. |
createColumnFilterWithParameter(comparisonType, columnPath, paramValue, paramDataType)
Creates a Compare
filter to instance to compare the column to a specified value.
Parameters
{Terrasoft.ComparisonType} comparisonType | The comparison operation type. |
{String} columnPath | The path to the check column, relative to the |
{Mixed} paramValue | The parameter value. |
{Terrasoft.DataValueType} paramDataType | The parameter data type. |
createColumnInFilterWithParameters(columnPath, paramValues, paramDataType)
Creates an In
filter instance to compare the value of a specified column to a parameter.
Parameters
{String} columnPath | The path to the check column, relative to the |
paramValues | The parameter value array. |
{Terrasoft.DataValueType} paramDataType | The parameter data type. |
createColumnIsNotNullFilter(columnPath)
Creates an IsNull
filter instance to check the specified column.
Parameters
{String} columnPath | The path to the check column, relative to the |
createColumnIsNullFilter(columnPath)
Creates an IsNull
filter instance to check the specified column.
Parameters
{String} columnPath | The path to the check column, relative to the |
createCompareFilter(comparisonType, leftExpression, rightExpression)
Creates a Compare
filter instance.
Parameters
{Terrasoft.ComparisonType} comparisonType | The comparison operation type. |
{Terrasoft.BaseExpression} leftExpression | The expression to check in the filter. |
{Terrasoft.BaseExpression} rightExpression | The filtering expression. |
createExistsFilter(columnPath)
Creates an Exists
filter instance for the [Exists by the specified condition]
type comparison. Sets the expression of the column at the specified path as the check value.
Parameters
{String} columnPath | The path to the column for whose expression to configure the filter. |
createFilter(comparisonType, leftColumnPath, rightColumnPath)
Creates an instance of the Terrasoft.CompareFilter
class filter to compare the values of two columns.
Parameters
{Terrasoft.ComparisonType} comparisonType | The comparison operation type. |
{String} leftColumnPath | The path to the check column, relative to the |
{String} rightColumnPath | The path to the filter column, relative to the |
createFilterGroup()
Creates a filter group instance.
createInFilter(leftExpression, rightExpressions)
Creates an In
filter instance.
Parameters
{Terrasoft.BaseExpression} leftExpression | The expression to check in the filter. |
{Terrasoft.BaseExpression[]} rightExpressions | The array of expressions to compare to |
createIsNotNullFilter(leftExpression)
Creates an IsNull
filter instance.
Parameters
{Terrasoft.BaseExpression} leftExpression | The expression to check by the |
createIsNullFilter(leftExpression)
Creates an IsNull
filter instance.
Parameters
{Terrasoft.BaseExpression} leftExpression | The expression to check by the |
createNotExistsFilter(columnPath)
Creates an Exists
filter instance for the [Does not exist by the specified condition]
type comparison. Sets the expression of the column located at the specified path as the check value.
Parameters
{String} columnPath | The path to the column for whose expression to configure the filter. |
createPrimaryDisplayColumnFilterWithParameter(comparisonType, paramValue, paramDataType)
Creates a filter object to compare the primary column to a parameter.
Parameters
{Terrasoft.ComparisonType} comparisonType | The comparison type. |
{Mixed} paramValue | The parameter value. |
{Terrasoft.DataValueType} paramDataType | The parameter data type. |
destroy()
Deletes the object instance. If the object has already been deleted, writes an error message to the console. Calls the onDestroy
virtual method to redefine in subclasses.
enablePrimaryColumnFilter(primaryColumnValue)
Enables filters by the primary key.
Parameters
{String/Number} primaryColumnValue | The value of the primary key. |
error(message)
Writes an error message to the message log.
Parameters
{String} message | The error message to write to the message log. |
execute(callback, scope)
The request to execute the query on the server.
Parameters
callback | The function to call after receiving the server response. |
scope | The scope within which to call the |
{Object} getDefSerializationInfo()
Returns the object that contains additional information for serialization.
getEntity(primaryColumnValue, callback, scope)
Returns the entity instance by the specified primaryColumnValue
primary key. Calls the callback
function within the scope
scope after retrieving the data.
Parameters
{String/Number} primaryColumnValue | The value of the primary key. |
callback | The function to call after receiving the server response. |
scope | The scope within which to call the |
getEntityCollection(callback, scope)
Returns the collection of entity instances that represent the query outcome. Calls the callback
function within the scope
scope after retrieving the data.
Parameters
callback | The function to call after receiving the server response. |
scope | The scope within which to call the |
{Object} getTypeInfo()
Returns the information about the element type.
log(message, [type])
Writes a message to the message log.
Parameters
{String|Object} message | The message to write to the message log. |
{Terrasoft.LogMessageType} type | The type of the |
onDestroy()
Deletes the event subscriptions and destroys the object.
serialize(serializationInfo)
Serializes the object in JSON.
Parameters
{String} serializationInfo | The results in JSON. |
setSerializableProperty(serializableObject, propertyName)
Assigns the property name to the object if the object is not empty or not a function.
Parameters
serializableObject | The serializable object. |
{String} propertyName | The property name. |
warning(message)
Writes a warning message to the message log.
Parameters
{String} message | The message to write to the message log. |