Sql class base

A base helper class for composing SQL constructs.

This wrapper class and its descendants do not prevent the composition of invalid SQL; the goal is only to simplify the composition process by avoiding direct string concatenation and interpolation. For example, the following fragment composes a WHERE clause using SqlI, SqlL, and Sql.>=, and then passes the "(\"distance\" >= 43)" string to the SQLite.prepare function:

QueryId qid = sqlite.prepare(
  where: SqlI("distance") >= SqlL(43),
  /* ... */

See also: FtsQuery.

Implementers
Annotations
  • @immutable

Constructors

Sql(String str)
Wraps the SQL construct provided in the given str argument.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
str String
The SQL construct wrapped by this Sql instance.
final

Methods

between(Sql a, Sql b) Sql
Composes and returns a parenthesis-enclosed BETWEEN operator.
concat(Sql x) Sql
Composes and returns a parenthesis-enclosed || operator.
equal(Sql x) Sql
Composes and returns a parenthesis-enclosed == operator.
glob(Sql x) Sql
Composes and returns a parenthesis-enclosed GLOB operator.
inX(Sql x) Sql
Composes and returns a parenthesis-enclosed IN operator.
isEqual(Sql x) Sql
Composes and returns a parenthesis-enclosed IS operator.
isNotEqual(Sql x) Sql
Composes and returns a parenthesis-enclosed IS NOT operator.
like(Sql x) Sql
Composes and returns a parenthesis-enclosed binary LIKE operator.
likeEscape(Sql a, Sql b) Sql
Composes and returns a parenthesis-enclosed ternary LIKE operator.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
not() Sql
Composes and returns a parenthesis-enclosed NOT operator.
notEqual(Sql x) Sql
Composes and returns a parenthesis-enclosed != operator.
toString() String
A string representation of this object.
inherited
trim() Sql
Removes the enclosing parentheses, if present, and returns the result.

Operators

operator %(Sql x) Sql
Composes and returns a parenthesis-enclosed % operator.
operator &(Sql x) Sql
Composes and returns a parenthesis-enclosed AND operator.
operator *(Sql x) Sql
Composes and returns a parenthesis-enclosed * operator.
operator +(Sql x) Sql
Composes and returns a parenthesis-enclosed + operator.
operator -(Sql x) Sql
Composes and returns a parenthesis-enclosed binary - operator.
operator /(Sql x) Sql
Composes and returns a parenthesis-enclosed / operator.
operator <(Sql x) Sql
Composes and returns a parenthesis-enclosed < operator.
operator <=(Sql x) Sql
Composes and returns a parenthesis-enclosed <= operator.
operator ==(Object other) bool
The equality operator.
inherited
operator >(Sql x) Sql
Composes and returns a parenthesis-enclosed > operator.
operator >=(Sql x) Sql
Composes and returns a parenthesis-enclosed >= operator.
operator unary-() Sql
Composes and returns a parenthesis-enclosed unary - operator.
operator |(Sql x) Sql
Composes and returns a parenthesis-enclosed OR operator.