discontinuedPackage electricsql has been discontinued.

QueryBuilder class abstract

Implementers

Constructors

QueryBuilder()
const

Properties

autoincrementPkType → String
The autoincrementing integer primary key type for the current SQL dialect.
final
blobType → String
The type to use for BLOB for the current SQL dialect.
final
defaultNamespace → String
final
deferOrDisableFKsForTx → String
Depending on the dialect, defers or disables foreign key checks for the duration of the transaction.
final
dialect → Dialect
final
getVersion → String
Queries the version of SQLite/Postgres we are using.
final
hashCode → int
The hash code for this object.
no setterinherited
paramSign → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

batchedInsertOrReplace(QualifiedTablename table, List<String> columns, List<Map<String, Object?>> records, List<String> conflictCols, List<String> updateCols, int maxSqlParameters) → List<Statement>
Inserts a batch of rows into a table, replacing them if they already exist.
countTablesIn(List<String> tableNames) → Statement
Counts tables whose name is included in tableNames.
createFkCompensationTrigger(String opType, QualifiedTablename table, String childKey, QualifiedTablename fkTable, String joinedFkPKs, ForeignKey foreignKey) → List<String>
Creates a trigger that logs compensations for operations into the oplog.
createIndex(String indexName, QualifiedTablename onTable, List<String> columns) → String
Create an index on a table.
createNoFkUpdateTrigger(QualifiedTablename table, List<String> pk) → List<String>
Create a trigger that prevents updates to the primary key.
createOplogTrigger(SqlOpType opType, QualifiedTablename table, String newPKs, String newRows, String oldRows) → List<String>
Create a trigger that logs operations into the oplog.
createOrReplaceDeleteTrigger(QualifiedTablename table, String newPKs, String newRows, String oldRows) → List<String>
Creates or replaces a trigger that logs deletions into the oplog.
createOrReplaceFkCompensationTrigger(String opType, QualifiedTablename table, String childKey, QualifiedTablename fkTable, String joinedFkPKs, ForeignKey foreignKey) → List<String>
createOrReplaceInsertCompensationTrigger(QualifiedTablename table, String childKey, QualifiedTablename fkTable, String joinedFkPKs, ForeignKey foreignKey) → List<String>
Creates a trigger that logs compensations for insertions into the oplog.
createOrReplaceInsertTrigger(QualifiedTablename table, String newPKs, String newRows, String oldRows) → List<String>
Creates or replaces a trigger that logs insertions into the oplog.
createOrReplaceNoFkUpdateTrigger(QualifiedTablename table, List<String> pk) → List<String>
Creates or replaces a trigger that prevents updates to the primary key.
createOrReplaceOplogTrigger(SqlOpType opType, QualifiedTablename table, String newPKs, String newRows, String oldRows) → List<String>
createOrReplaceUpdateCompensationTrigger(QualifiedTablename table, String childKey, QualifiedTablename fkTable, String joinedFkPKs, ForeignKey foreignKey) → List<String>
Creates a trigger that logs compensations for updates into the oplog.
createOrReplaceUpdateTrigger(QualifiedTablename table, String newPKs, String newRows, String oldRows) → List<String>
Creates or replaces a trigger that logs updates into the oplog.
dropTriggerIfExists(String triggerName, QualifiedTablename table) → String
Drop a trigger if it exists.
getLocalTableNames([List<String> notIn = const []]) → Statement
Fetches the names of all tables that are not in notIn.
getTableInfo(QualifiedTablename table) → Statement
Fetches information about the columns of a table. The information includes all column names, their type, whether or not they are nullable, and whether they are part of the PK.
hexValue(String hexString) → String
Converts a hexidecimal string to a hex value.
insertOrIgnore(QualifiedTablename table, List<String> columns, List<Object?> values) → Statement
Insert a row into a table, ignoring it if it already exists.
insertOrReplace(QualifiedTablename table, List<String> columns, List<Object?> values, List<String> conflictCols, List<String> updateCols) → Statement
Insert a row into a table, replacing it if it already exists.
insertOrReplaceWith(QualifiedTablename table, List<String> columns, List<Object?> values, List<String> conflictCols, List<String> updateCols, List<Object?> updateVals) → Statement
Insert a row into a table. If it already exists we update the provided columns updateCols with the provided values updateVals
makePositionalParam(int i) → String
Makes the i-th positional parameter, e.g. '$3' For Postgres when i is 3 and always '?' for SQLite
makeQT(String tablename) → QualifiedTablename
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pgOnly(String query) → String
Returns the given query if the current SQL dialect is PostgreSQL.
prepareDeleteBatchedStatements(String baseSql, List<String> columns, List<Map<String, Object?>> records, int maxParameters, {String suffixSql = ''}) → List<Statement>
Prepare multiple batched DELETE statements for an array of records.
prepareInsertBatchedStatements(String baseSql, List<String> columns, List<Map<String, Object?>> records, int maxParameters, [String suffixSql = '']) → List<Statement>
Prepare multiple batched insert statements for an array of records.
removeDeletedShadowRows(QualifiedTablename oplogTable, QualifiedTablename shadowTable) → String
Deletes any shadow rows where the last oplog operation was a DELETE
setTagsForShadowRows(QualifiedTablename oplogTable, QualifiedTablename shadowTable) → String
For each affected shadow row, set new tag array, unless the last oplog operation was a DELETE
setTriggerSetting(QualifiedTablename table, int value) → String
Modifies the trigger setting for the table identified by its tablename and namespace.
sqliteOnly(String query) → String
Returns the given query if the current SQL dialect is SQLite.
tableExists(QualifiedTablename table) → Statement
Checks if the given table exists.
toHex(String column) → String
Converts a column value to a hexidecimal string.
toString() → String
A string representation of this object.
inherited

Operators

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