ConditionSQLEncoder class

A Condition encoder for SQL.

Inheritance

Constructors

ConditionSQLEncoder(SchemeProvider schemeProvider, {required String sqlElementQuote, String? intParameterTypeSuffix, int maxIDsAsParameters = 512, SQLRegExpSyntax regExpSyntax = SQLRegExpSyntax.function, String subqueryFromSQL(String table, EncodingContext subContext)?, bool subqueryAsDerivedTable = false})

Properties

groupCloser → String
no setteroverride
groupOpener → String
no setteroverride
groupOperatorAND → String
no setteroverride
groupOperatorOR → String
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
intParameterTypeSuffix → String?
See SQLDialect.intParameterTypeSuffix.
final
maxIDsAsParameters → int
See SQLDialect.maxIDsAsParameters.
final
regExpSyntax → SQLRegExpSyntax
See SQLDialect.regExpSyntax.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemeProvider → SchemeProvider?
finalinherited
sqlElementQuote → String
final
subqueryAsDerivedTable → bool
See SQLDialect.subqueryAsDerivedTable.
final
subqueryFromSQL → String Function(String table, EncodingContext subContext)?
Builds the FROM clause (FROM table as alias JOIN ..., without the WHERE) of a condition encoded in a sub-context, for the subquery of a ConditionNOT through other tables. Set by the SQL adapter.
final

Methods

conditionParameterToParameterValue(ConditionParameter parameter, EncodingContext context, String? fieldKey, Type? fieldType, {bool valueAsList = false}) → FutureOr<EncodingValue<String, Object?>>
encode(Condition condition, String entityName, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, Transaction? transaction, String? tableName, String? tableFieldID}) → FutureOr<EncodingContext>
inherited
encodeCondition(Condition c, EncodingContext context) → FutureOr<EncodingContext>
inherited
encodeConditionNOT(ConditionNOT c, EncodingContext context) → FutureOr<EncodingContext>
Encodes a ConditionNOT, the complement of its condition (see ConditionNOT), encoded in a sub-context (EncodingContext.sub):
override
encodeConditionValuesWithOperator(EncodingContext context, Type keyType, String? fieldKey, String tableKey, String operator, dynamic values, bool valueAsList, {bool negated = false, bool nullable = true, Condition? condition, bool nullsAsAbsent = false}) → FutureOr<EncodingContext>
encodeEncodingPlaceholder(EncodingPlaceholder p) → String
inherited
encodeEncodingPlaceholderIndex(EncodingPlaceholderIndex p) → String
inherited
encodeEncodingValueList(EncodingValueList p) → String
inherited
encodeEncodingValueNull(EncodingValueNull<String> p) → String
inherited
encodeEncodingValuePrimitive(EncodingValuePrimitive<String, Object?> p) → String
inherited
encodeEncodingValueText(EncodingValueText<String> p) → String
inherited
encodeGroupCondition(GroupCondition c, EncodingContext context) → FutureOr<EncodingContext>
inherited
encodeGroupConditionAND(GroupConditionAND c, EncodingContext context) → FutureOr<EncodingContext>
inherited
encodeGroupConditionOperator(GroupCondition c, EncodingContext context, String operator) → FutureOr<EncodingContext>
inherited
encodeGroupConditionOR(GroupConditionOR c, EncodingContext context) → FutureOr<EncodingContext>
inherited
encodeIDCondition(ConditionID c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeIDConditionIN(ConditionIdIN c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeIDValues(EncodingContext context, Type idType, String idKey, String tableKey, Object? idValue, bool isList) → FutureOr<EncodingContext>
Writes the comparison of the ID column (tableKey) with idValue (=) or with the idValue list (IN), as parameters (placeholders) rather than values written into the SQL: the statement text is the same for any ID, so it can be reused (prepared statements, SQL caches).
encodeKeyCondition(KeyCondition c, EncodingContext context) → FutureOr<EncodingContext>
inherited
encodeKeyConditionEQ(KeyConditionEQ c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionGreaterThan(KeyConditionGreaterThan c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionGreaterThanOrEqual(KeyConditionGreaterThanOrEqual c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionIN(KeyConditionIN c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionLessThan(KeyConditionLessThan c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionLessThanOrEqual(KeyConditionLessThanOrEqual c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionNotEQ(KeyConditionNotEQ c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionNotIN(KeyConditionNotIN c, EncodingContext context) → FutureOr<EncodingContext>
override
encodeKeyConditionOperator(KeyCondition c, EncodingContext context, String operator, {bool valueAsList = false}) → FutureOr<EncodingContext>
encodeKeyConditionRegExp(KeyConditionRegExp c, EncodingContext context) → FutureOr<EncodingContext>
Encodes a KeyConditionRegExp with the regExpSyntax. The pattern is always a parameter (never written in the SQL): a literal pattern in a new parameter, and a pattern parameter (/?:name/) in its own key, holding its pattern (SQLRegExpSyntax.adaptPattern), or for SQLRegExpSyntax.dart, its value as is (a RegExp keeps its i flag when the condition is matched in memory).
override
escapeStringQuotes(String valueStr, String quote) → String
inherited
isNullEncodingValue(EncodingValue<String, Object?> value, EncodingContext context) → bool
Whether value is a comparison against SQL NULL.
keyFieldReferenceToSQL(KeyCondition c, EncodingContext context) → FutureOr<MapEntry<Type, String>>
keyFieldToSQL(KeyCondition c, EncodingContext context) → FutureOr<MapEntry<Type, String>>
keyToSQL(KeyCondition c, EncodingContext context) → FutureOr<MapEntry<Type, String>>
newParameterKey(EncodingContext context, String prefix, {bool accept(String key)?}) → String
A parameter key, from prefix, not used by the context's placeholders (nor as an IN list key) nor named parameters: prefix, prefix_1, prefix_2... Or, the first one that accepts.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameterPlaceholder(String parameterKey) → String
override
parameterPlaceholderIndexKey(String parameterKey, int index) → String
inherited
pruneUnusedParametersPlaceholders(EncodingContext context) → void
Drops the placeholders that the encoded output never references.
inherited
qualifiedColumnSQL(String tableAlias, String column) → String
A column qualified by its table alias, quoted with sqlElementQuote: "alias"."column". As SQLDialect.qualifiedColumnSQL (with the dialect's quote).
resolveEntityAlias(EncodingContext context, String entityName) → String
inherited
resolveFieldName(String tableName, String fieldName) → FutureOr<String>
override
resolveParameterValue(String valueKey, ConditionParameter value, EncodingContext context, Type? valueType, {bool valueAsList = false}) → FutureOr<EncodingValue<String, Object?>>
inherited
resolveValueToCompatibleType(Object? value) → FutureOr<Object?>
override
resolveValueToType(Object? value, Type valueType, {bool valueAsList = false}) → FutureOr<Object?>
inherited
toString() → String
A string representation of this object.
inherited
valueToParameterValue(EncodingContext context, dynamic value, {String? fieldKey, Type? fieldType, bool valueAsList = false}) → FutureOr<EncodingValue<String, Object?>>
valueToParameterValueList(Object? value, Type? type, {String? key}) → EncodingValueList<String>
valueToSQL(EncodingContext context, dynamic value, {String? fieldKey, Type? fieldType, bool valueAsList = false}) → FutureOr<String>
valueToSQLPlain(Object? value, Type? type, {String? key}) → EncodingValue<String, Object?>

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

idsListPaddedLength(int length) → int
The length an IN list of IDs is padded to: 1, 2, 4, 8 ... up to 256, then multiples of 256.