Types
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

Type definition

The position in the original SQL expression string for a SQL node in the parse tree returned by WhereClause.parseTree.

See also

offset

Property
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

Property
Type
number

The 1-based line number in the original SQL string at which the node starts.

column

Property
Type
number

The 1-based column number in the original SQL string at which the node starts.

SQLSourceLocation

Type definition

A source location range in the original SQL string.

The location spans from SQLSourceLocation (inclusive) to SQLSourceLocation (exclusive).

source

Property
Type
unknown | undefined

start

Property
Type
SourcePosition

The inclusive start position of the range.

end

Property
Type
SourcePosition

The exclusive end position of the range.

SQLSyntaxError

Type definition

Error thrown when a SQL expression cannot be parsed.

Supertypes
Error

name

Property
Type
"SyntaxError"

The syntax error name. It is always "SyntaxError".

message

Property
Type
string

A description of the parse error.

location

Property
Type
SQLSourceLocation

The location in the original SQL string associated with the parse error.

SimpleAttributes

Type definition

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 attributes property (for example, { attributes: { POPULATION: 300000 } }, such as a Graphic).
Type
{ attributes: Record<string, unknown>; } | Record<string, any>

SQLNode

Type definition
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.

SimpleCaseNode

Type definition
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.

type

Property
Type
"case-expression"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full CASE ... END expression.

format

Property
Type
"simple"

The case expression format. Value for this property is always "simple".

clauses

Property
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

Property
Type
SQLNode

The expression following the CASE keyword. This value is compared to each clause operand.

else

Property
Type
SQLNode | null

The ELSE result expression, or null if the ELSE clause is not present.

elseLocation

Property
Type
SQLSourceLocation | null

Location of the ELSE keyword and result expression, or null if the ELSE clause is not present.

SearchedCaseNode

Type definition
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.

type

Property
Type
"case-expression"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full CASE ... END expression.

format

Property
Type
"searched"

The case expression format. Value for this property is always "searched".

clauses

Property
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.

else

Property
Type
SQLNode | null

The ELSE result expression, or null if the ELSE clause is not present.

elseLocation

Property
Type
SQLSourceLocation | null

Location of the ELSE keyword and result expression, or null if the ELSE clause is not present.

WhenNode

Type definition
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 operand is compared against the simple case operand.
  • In a searched case expression, WhenNode's operand is evaluated as a condition.

When the clause matches, WhenNode's value determines the result.

type

Property
Type
"when-clause"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full WHEN ... THEN ... clause.

operand

Property
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

Property
Type
SQLNode

The expression following the THEN keyword. This expression determines the result when the clause matches.

ParamNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A parameter reference node. Parameter references use the @name syntax in SQL expressions.

type

Property
Type
"parameter"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full @name parameter reference.

value

Property
Type
string

The parameter name without the leading @. The name is matched against parameters using a case-insensitive lookup.

ListNode

Type definition
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>).

type

Property
Type
"expression-list"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full list expression.

value

Property
Type
SQLNode[]

The expressions in the list, in source order.

UnaryNode

Type definition
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.

type

Property
Type
"unary-expression"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full unary node.

operator

Property
Type
"NOT"

The unary operator. Value for this property is always "NOT" since it is the only unary operator supported in SQL expressions.

expr

Property
Type
SQLNode

The sql node.

BinaryNode

Type definition
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 (+).

type

Property
Type
"binary-expression"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the full binary node.

operator

Property
Type
BinaryOperator

Defines the way two expressions are combined to yield a single result.

left

Property
Type
SQLNode

SQL node to the left of the binary node.

right

Property
Type
SQLNode

SQL node to the right of the binary node.

escape

Property
Type
string | undefined

Escape string.

NullNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains NULL value.

type

Property
Type
"null"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the NULL literal in the original SQL string.

value

Property
Type
null

Null value.

BoolNode

Type definition
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.

type

Property
Type
"boolean"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the boolean literal in the original SQL string.

value

Property
Type
boolean

Values are true or false.

StringNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains string.

type

Property
Type
"string"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the string literal in the original SQL string.

value

Property
Type
string

The string value.

NumberNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains number.

type

Property
Type
"number"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the number literal in the original SQL string.

value

Property
Type
number

Numeric value.

DateNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains date.

type

Property
Type
"date"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the date literal in the original SQL string.

value

Property
Type
string

The date value.

TimeNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains time.

type

Property
Type
"time"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the time literal in the original SQL string.

value

Property
Type
string

The time value.

TimeStampNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains date.

type

Property
Type
"timestamp"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the timestamp literal in the original SQL string.

value

Property
Type
string

String date value.

ColumnNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains column name of a layer or table.

type

Property
Type
"column-reference"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the column name in the original SQL string.

column

Property
Type
string

Column or field name.

CurrentTimeNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A node that contains CURRENT_TIMESTAMP, CURRENT_TIME, or CURRENT_DATE functions.

type

Property
Type
"current-time"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the current time function in the original SQL string.

mode

Property
Type
"timestamp" | "date" | "time"

The current time node mode.

CurrentUserNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.31

A node that contains CURRENT_USER function.

type

Property
Type
"current-user"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the current user function in the original SQL string.

IntervalNode

Type definition
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.

type

Property
Type
"interval"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the interval expression in the original SQL string.

value

Property
Type
StringNode | ParamNode

Interval node value.

op

Property
Type
"+" | "-" | ""

Interval node sign.

qualifier

Property
Type
IntervalQualifierNode | IntervalPeriodNode

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>.

IntervalQualifierNode

Type definition
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>.

type

Property
Type
"interval-qualifier"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the interval qualifier in the original SQL string.

start

Property
Type
IntervalPeriodNode

The start interval node period.

end

Property
Type
IntervalPeriodNode

The end interval node period.

IntervalPeriodNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

Interval period node.

type

Property
Type
"interval-period"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the interval period in the original SQL string.

period

Property
Type
"day" | "month" | "hour" | "second" | "year" | "minute"

Interval node periods.

precision

Property
Type
number | null

Precision for an interval data type includes interval leading precision, interval precision, and seconds precision.

secondary

Property
Type
number | null

Seconds precision.

FunctionNode

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.24

A nodes that contains SQL function.

type

Property
Type
"function"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the SQL function in the original SQL string.

name

Property
Type
string

Name of the SQL function.

args

Property
Type
ListNode

Function arguments.

BinaryOperator

Type definition

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

Type definition
Since
ArcGIS Maps SDK for JavaScript 4.26

A node that contains data type. It is used in CAST expressions.

type

Property
Type
"data-type"

SQL node type.

location

Property
Type
SQLSourceLocation

Location of the data type in the original SQL string.

value

Property
Type
DataTypeNodeValue

DataTypeNodeValue

Type definition

Data type node value. It contains the name of the data type and an optional size for character types.

type

Property
Type
"integer" | "real" | "smallint" | "float" | "date" | "timestamp" | "varchar" | "time"

The name of the data type.

size

Property
Type
number | undefined

Size of the data type. It is applicable for character types such as varchar.