SQLComparisonExpression
Class: SQLComparisonExpression
Defined in: packages/sql/lib/comparison.d.ts:13
Extends ComparisonExpression to emit SQL for JSON comparisons
With the JSON path of the attribute (jsonAttribute), comparisons follow the in-memory semantics:
- a number or a boolean only matches a JSON number or boolean: a missing field, a null or another type never matches, and never raises a cast error;
!=matches a missing field, a null or another type (null-safe inequality);- strings compare the text of the value, so a number field equals its text (
n = '1'), as the loose==does; CONTAINSonly matches an array holding the value.
Extends
ComparisonExpression
Constructors
Constructor
new SQLComparisonExpression(
operator,attribute,value,dialect,jsonAttribute?):SQLComparisonExpression
Defined in: packages/sql/lib/comparison.d.ts:24
Create a new SQLComparisonExpression instance
Parameters
operator
ComparisonOperator
the comparison operator
attribute
string
the SQL text of the attribute
value
any
the value
dialect
the engine syntax
jsonAttribute?
string
the SQL JSON value of the attribute, for typed comparisons
Returns
SQLComparisonExpression
Overrides
WebdaQL.ComparisonExpression.constructor
Properties
attribute
attribute:
string[]
Defined in: packages/ql/lib/query.d.ts:459
Attribute to read from the object (split by .)
Inherited from
WebdaQL.ComparisonExpression.attribute
dialect
protectedreadonlydialect:SQLDialect
Defined in: packages/sql/lib/comparison.d.ts:14
jsonAttribute?
protectedreadonlyoptionaljsonAttribute?:string
Defined in: packages/sql/lib/comparison.d.ts:15
operator
operator:
ComparisonOperator
Defined in: packages/ql/lib/query.d.ts:408
Operator
Inherited from
WebdaQL.ComparisonExpression.operator
rawValue
rawValue:
value|DynamicValue| value | DynamicValue[] |null
Defined in: packages/ql/lib/query.d.ts:455
Right side of the comparison (raw parsed value, possibly DynamicValue)
Inherited from
WebdaQL.ComparisonExpression.rawValue
Accessors
value
Get Signature
get value():
value|value[] |null
Defined in: packages/ql/lib/query.d.ts:471
Resolved value at evaluation time
Returns
value | value[] | null
the resolved scalar or array value
Set Signature
set value(
val):void
Defined in: packages/ql/lib/query.d.ts:476
Set the raw value
Parameters
val
value | DynamicValue | value | DynamicValue[] | null
new value
Returns
void
Inherited from
WebdaQL.ComparisonExpression.value
Methods
eval()
eval(
target):boolean
Defined in: packages/ql/lib/query.d.ts:511
Parameters
target
any
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.eval
isDynamic()
isDynamic():
boolean
Defined in: packages/ql/lib/query.d.ts:480
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.isDynamic
setAttributeValue()
setAttributeValue(
target):void
Defined in: packages/ql/lib/query.d.ts:507
Set the value of the attribute based on the assignment
If used as a Set expression
Parameters
target
any
the object to assign to
Returns
void
Inherited from
WebdaQL.ComparisonExpression.setAttributeValue
toString()
toString():
string
Defined in: packages/sql/lib/comparison.d.ts:40
Returns
string
the SQL condition
Overrides
WebdaQL.ComparisonExpression.toString
toStringAttribute()
toStringAttribute():
string
Defined in: packages/sql/lib/comparison.d.ts:35
Returns
string
SQL attribute expression, typed when the value is a number or a boolean
Overrides
WebdaQL.ComparisonExpression.toStringAttribute
toStringOperator()
toStringOperator():
ComparisonOperator
Defined in: packages/ql/lib/query.d.ts:530
Allow subclass to create different display
Returns
ComparisonOperator
the operator string
Inherited from
WebdaQL.ComparisonExpression.toStringOperator
toStringValue()
toStringValue(
value):string
Defined in: packages/sql/lib/comparison.d.ts:30
Parameters
value
value | DynamicValue | value | DynamicValue[] | null
the value to stringify
Returns
string
SQL-compatible literal
Overrides
WebdaQL.ComparisonExpression.toStringValue
getAttributeValue()
staticgetAttributeValue(target,attribute):any
Defined in: packages/ql/lib/query.d.ts:500
Traverse an object using a dot-notation attribute path
Parameters
target
any
object to read from
attribute
string[]
path segments (e.g. ["user", "profile", "name"])
Returns
any
the resolved value, or undefined if any segment is missing
Inherited from
WebdaQL.ComparisonExpression.getAttributeValue
likeToRegex()
staticlikeToRegex(like):RegExp
Defined in: packages/ql/lib/query.d.ts:492
Convert a SQL LIKE pattern to a JavaScript RegExp
%matches zero or more characters_matches exactly one character\%and\_are literal percent/underscore- Common regex metacharacters are escaped
Parameters
like
string
SQL LIKE pattern string
Returns
RegExp
compiled RegExp
Inherited from
WebdaQL.ComparisonExpression.likeToRegex