FlutterQueryExecutor class
A query executor that uses sqflite internally.
- Inheritance
-
- Object
- QueryExecutor
- FlutterQueryExecutor
Constructors
- FlutterQueryExecutor({required String path, bool? logStatements, bool singleInstance = true, DatabaseCreator? creator})
-
A query executor that will store the database in the file declared by
path
. IflogStatements
is true, statements sent to the database will be printed, which can be handy for debugging. ThesingleInstance
parameter sets the corresponding parameter ons.openDatabase
. Thecreator
will be called when the database file doesn't exist. It can be used to, for instance, populate default data from an asset. Note that migrations might behave differently when populating the database this way. For instance, a database created by ancreator
will not receive the MigrationStrategy.onCreate callback because it hasn't been created by moor. - FlutterQueryExecutor.inDatabaseFolder({required String path, bool? logStatements, bool singleInstance = true, DatabaseCreator? creator})
-
A query executor that will store the database in the file declared by
path
, which will be resolved relative tos.getDatabasesPath()
. IflogStatements
is true, statements sent to the database will be printed, which can be handy for debugging. ThesingleInstance
parameter sets the corresponding parameter ons.openDatabase
. Thecreator
will be called when the database file doesn't exist. It can be used to, for instance, populate default data from an asset. Note that migrations might behave differently when populating the database this way. For instance, a database created by ancreator
will not receive the MigrationStrategy.onCreate callback because it hasn't been created by moor.
Properties
- delegate → DatabaseDelegate
-
The
DatabaseDelegate
to send queries to.finalinherited - dialect → SqlDialect
-
The SqlDialect to use for this database engine.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- impl → QueryDelegate
-
no setterinherited
- isSequential → bool
-
no setter
- logStatements ↔ bool
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sqfliteDb → Database?
-
The underlying sqflite
s.Database
object used by moor to send queries.no setter
Methods
-
beginTransaction(
) → TransactionExecutor -
Starts a TransactionExecutor.
inherited
-
close(
) → Future< void> -
Closes this database connection and releases all resources associated with
it. Implementations should also handle close calls in a state where the
database isn't open.
inherited
-
ensureOpen(
QueryExecutorUser user) → Future< bool> -
Opens the executor, if it has not yet been opened.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runBatched(
BatchedStatements statements) → Future< void> -
Prepares and runs
statements
.inherited -
runCustom(
String statement, [List< Object?> ? args]) → Future<void> -
Runs a custom SQL statement without any variables. The result of that
statement will be ignored.
inherited
-
runDelete(
String statement, List< Object?> args) → Future<int> -
Runs an delete statement and returns how many rows where affected.
inherited
-
runInsert(
String statement, List< Object?> args) → Future<int> -
Runs an insert statement with the given variables. Returns the row id or
the auto_increment id of the inserted row.
inherited
-
runSelect(
String statement, List< Object?> args) → Future<List< Map< >String, Object?> > -
Runs a select statement with the given variables and returns the raw
results.
inherited
-
runUpdate(
String statement, List< Object?> args) → Future<int> -
Runs an update statement with the given variables and returns how many
rows where affected.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited