import type { SourcePosition, SQLSourceLocation, SQLSyntaxError, SimpleAttributes, SQLNode } from "@arcgis/core/core/sql/types.js";- Since
- ArcGIS Maps SDK for JavaScript 5.0
A module for importing types used in sql and WhereClause modules.
Type definitions
SourcePosition
The position in the original SQL expression string for a SQL node in the parse tree returned by WhereClause.parseTree.
- See also
offset
- Type
- number
The 0-based character offset in the original SQL string where the node starts.
Together with line and column, this allows precise mapping
of the parse tree node back to its position in the source.
line
- Type
- number
The 1-based line number in the original SQL string at which the node starts.
column
- Type
- number
The 1-based column number in the original SQL string at which the node starts.
SQLSourceLocation
A source location range in the original SQL string.
The location spans from SQLSourceLocation (inclusive) to SQLSourceLocation (exclusive).
SQLSyntaxError
Error thrown when a SQL expression cannot be parsed.
- Supertypes
- Error
location
- Type
- SQLSourceLocation
The location in the original SQL string associated with the parse error.
SimpleAttributes
A minimal feature/attributes object used by WhereClause.calculateValue() or WhereClause.testFeature(). The where clause evaluator can read attribute values from either:
- A plain object (for example,
{ POPULATION: 300000 }), or - An object containing an
attributesproperty (for example,{ attributes: { POPULATION: 300000 } }, such as a Graphic).
SQLNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
SQL parse tree is composed of SqlNodes. It may be an operator, literal, function, list, and so forth.
- Type
- BinaryNode | BoolNode | ColumnNode | CurrentTimeNode | CurrentUserNode | DataTypeNode | DateNode | FunctionNode | IntervalNode | IntervalPeriodNode | IntervalQualifierNode | ListNode | NullNode | NumberNode | ParamNode | SearchedCaseNode | SimpleCaseNode | StringNode | TimeNode | TimeStampNode | UnaryNode | WhenNode
SimpleCaseNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A simple case expression node. This represents expressions of the form:
CASE <operand> WHEN <whenOperand> THEN <result> ... [ELSE <elseResult>] END
During evaluation, the operand value is compared to each
WHEN operand using equality. The first matching clause determines the result. If no clause matches,
the ELSE expression is used when present, otherwise the result is null.
clauses
- Type
- WhenNode[]
Ordered WHEN ... THEN ... clauses.
Each clause's WhenNode.operand is compared against the
SimpleCaseNode's operand, and the matching clause's
WhenNode.value determines the result.
operand
- Type
- SQLNode
The expression following the CASE keyword.
This value is compared to each clause operand.
elseLocation
- Type
- SQLSourceLocation | null
Location of the ELSE keyword and result expression, or null if the ELSE clause is not present.
SearchedCaseNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A searched CASE expression node.
Represents expressions of the form:
CASE WHEN <condition> THEN <result> ... [ELSE <elseResult>] END
During evaluation, each WHEN condition is evaluated in order.
The result of the first condition that evaluates to true is returned.
If no condition matches, the ELSE expression is evaluated if present; otherwise, the result is null.
clauses
- Type
- WhenNode[]
Ordered WHEN ... THEN ... clauses.
Each clause's WhenNode.operand is evaluated as a condition, and the
first clause whose condition evaluates to true determines the result.
elseLocation
- Type
- SQLSourceLocation | null
Location of the ELSE keyword and result expression, or null if the ELSE clause is not present.
WhenNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A WHEN ... THEN ... clause in a CASE expression.
This node is used by both SimpleCaseNode and
SearchedCaseNode:
- In a simple case expression, WhenNode's
operandis compared against the simple case operand. - In a searched case expression, WhenNode's
operandis evaluated as a condition.
When the clause matches, WhenNode's value determines the result.
operand
- Type
- SQLNode
The expression following the WHEN keyword.
In simple case expressions, this expression is compared against the case operand.
In searched case expressions, this expression is evaluated as a condition.
value
- Type
- SQLNode
The expression following the THEN keyword.
This expression determines the result when the clause matches.
ParamNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A parameter reference node. Parameter references use the @name syntax in SQL expressions.
value
- Type
- string
The parameter name without the leading @.
The name is matched against parameters using a case-insensitive lookup.
ListNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
An ordered list of SQL expressions.
This node is commonly produced for parenthesized expression lists (for example, function call
arguments or IN (<expr>, <expr>, ...) lists). It is also used for other constructs that naturally
form an ordered set of expressions (for example, BETWEEN <begin> AND <end>).
UnaryNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A node that contains unary operator. Unary operators can be applied only to expressions that evaluate to any one of the data types of the numeric data type category.
BinaryNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A binary expression node. It is an operator that defines the way two expressions are combined to yield a single result. It can be an arithmetic operator, the assignment operator (=), a comparison operator (>=), a logical operator (AND), or a string concatenation operator (+).
operator
- Type
- BinaryOperator
Defines the way two expressions are combined to yield a single result.
BoolNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A node that contains a boolean expression. Used for expressing a condition or criterion which can be either true or false.
location
- Type
- SQLSourceLocation
Location of the boolean literal in the original SQL string.
TimeStampNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A node that contains date.
location
- Type
- SQLSourceLocation
Location of the timestamp literal in the original SQL string.
ColumnNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A node that contains column name of a layer or table.
CurrentTimeNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A node that contains CURRENT_TIMESTAMP, CURRENT_TIME, or CURRENT_DATE functions.
location
- Type
- SQLSourceLocation
Location of the current time function in the original SQL string.
CurrentUserNode
- Since
- ArcGIS Maps SDK for JavaScript 4.31
A node that contains CURRENT_USER function.
location
- Type
- SQLSourceLocation
Location of the current user function in the original SQL string.
IntervalNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
Interval node indicates that the character literal is an interval. An interval is defined as the difference between two dates and times.
location
- Type
- SQLSourceLocation
Location of the interval expression in the original SQL string.
IntervalQualifierNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
Node that contains interval qualifier. The interval qualifier can either be a single datetime field or be composed of two datetime fields,
in the form: <leading field> TO <trailing field>.
location
- Type
- SQLSourceLocation
Location of the interval qualifier in the original SQL string.
IntervalPeriodNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
Interval period node.
location
- Type
- SQLSourceLocation
Location of the interval period in the original SQL string.
FunctionNode
- Since
- ArcGIS Maps SDK for JavaScript 4.24
A nodes that contains SQL function.
BinaryOperator
A binary operator that defines the way two expressions are combined to yield a single result.
- Type
- "AND" | "OR" | "IS" | "ISNOT" | "IN" | "NOT IN" | "BETWEEN" | "NOTBETWEEN" | "LIKE" | "NOT LIKE" | "<>" | "<" | ">" | ">=" | "<=" | "=" | "*" | "-" | "+" | "/" | "||"
DataTypeNode
- Since
- ArcGIS Maps SDK for JavaScript 4.26
A node that contains data type. It is used in CAST expressions.