SQLComparisonExpression
Class: SQLComparisonExpression
Defined in: 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: sql/lib/comparison.d.ts:23
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: ql/lib/query.d.ts:452
Attribute to read from the object (split by .)
Inherited from
WebdaQL.ComparisonExpression.attribute
dialect
protectedreadonlydialect:SQLDialect
Defined in: sql/lib/comparison.d.ts:14
jsonAttribute?
protectedreadonlyoptionaljsonAttribute?:string
Defined in: sql/lib/comparison.d.ts:15
operator
operator:
ComparisonOperator
Defined in: ql/lib/query.d.ts:401
Inherited from
WebdaQL.ComparisonExpression.operator
rawValue
rawValue:
value|DynamicValue| value | DynamicValue[] |null
Defined in: ql/lib/query.d.ts:448
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: ql/lib/query.d.ts:463
Resolved value at evaluation time
Returns
value | value[] | null
the resolved scalar or array value
Set Signature
set value(
val):void
Defined in: ql/lib/query.d.ts:468
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: ql/lib/query.d.ts:503
Parameters
target
any
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.eval
isDynamic()
isDynamic():
boolean
Defined in: ql/lib/query.d.ts:472
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.isDynamic
setAttributeValue()
setAttributeValue(
target):void
Defined in: ql/lib/query.d.ts:499
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: sql/lib/comparison.d.ts:39
Returns
string
the SQL condition
Overrides
WebdaQL.ComparisonExpression.toString
toStringAttribute()
toStringAttribute():
string
Defined in: sql/lib/comparison.d.ts:34
Returns
string
SQL attribute expression, typed when the value is a number or a boolean
Overrides
WebdaQL.ComparisonExpression.toStringAttribute
toStringOperator()
toStringOperator():
ComparisonOperator
Defined in: ql/lib/query.d.ts:522
Allow subclass to create different display
Returns
ComparisonOperator
the operator string
Inherited from
WebdaQL.ComparisonExpression.toStringOperator
toStringValue()
toStringValue(
value):string
Defined in: sql/lib/comparison.d.ts:29
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: ql/lib/query.d.ts:492
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: ql/lib/query.d.ts:484
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