DBAccess class
The database access transaction. It is designed to used with access.
- Inheritance
-
- Object
- PostgresqlAccess
- DBAccess
Properties
- agent → AccessAgent
-
The interface for accessing the storage (aka., database).
*
no setterinherited
- closed → bool
-
Whether this transaction is closed.
no setter
- conn → Connection
-
The connection to the postgreSQL server.
finalinherited
-
dataset
→ Map<
String, dynamic> -
A map of application-specific data.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRollingback → bool
-
Whether this transaction was marked as rollback.
It actually returns
rollingback != false
.no setter - reader → AccessReader
-
The access reader for converting data from what the database returns.
finalinherited
- rollingback ↔ dynamic
-
A flag or a cause to indicate the access (aka., the transaction) shall
be rolled back at the end.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- slowSqlThreshold ↔ Duration?
-
How long to consider the query or execution of a SQL statement is slow.
If not specified (i.e., null), the value specified in configure is used.
getter/setter pair
- writer → AccessWriter
-
The access writer for converting data into what the database accepts.
finalinherited
Methods
-
afterCommit(
FutureOr task()) → void - Adds a task that will be executed after the transaction is committed
-
afterRollback(
FutureOr task(dynamic error)) → void - Adds a task that will be executed after the transaction is rolled back.
-
cache<
T extends Entity> (T entity) → T -
Caches the entity.
It returns
entity
directly.inherited -
clearCache(
) → void -
Clear the cache.
inherited
-
close(
) → Future - Forces the transaction to close immediately. You rarely need to call this method, since the transaction will be closed automatically by access.
-
delete(
String otype, String oid) → Future< int> -
Deletes the entity of the given
oid
. -
execute(
String sql, [dynamic values]) → Future< int> -
Queues a command for execution, and when done, returns the number of rows
affected by the SQL command.
override
-
exists(
String otype, String oid) → Future< bool> -
Tests if the given
oid
exists. -
fetch<
T extends Entity> (String? otype, String? oid) → T? -
Returns the entity of the given OID, if it is stored in the cache.
inherited
-
insert(
String otype, Map< String, dynamic> data, {Map<String, String> ? types, String? append}) → Future - Inserts the entity specified in data.
-
load<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), String? oid, [AccessOption? option]) → Future<T?> -
Loads the entity by the given
oid
, or null if not found. -
loadAllBy<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), Map<String, dynamic> whereValues, [AccessOption? option]) → Future<List< T> > - Loads all entities of the given AND criteria.
-
loadAllWith<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), String? whereClause, [Map<String, dynamic> ? whereValues, String? fromClause, String? shortcut, AccessOption? option]) → Future<List< T> > - Loads all entities of the given criteria (never null). *
-
loadBy<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), Map<String, dynamic> whereValues, [AccessOption? option]) → Future<T?> - Loads the first entity of the given AND criteria.
-
loadWhile<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), bool test(T lastLoaded, List<T> loaded), String? whereClause, [Map<String, dynamic> ? whereValues, String? fromClause, String? shortcut, AccessOption? option]) → Future<List< T> > -
Loads entities while
test
returns true. -
loadWith<
T extends Entity> (Iterable< String> ? fields, T newInstance(String oid), String? whereClause, [Map<String, dynamic> ? whereValues, String? fromClause, String? shortcut, AccessOption? option]) → Future<T?> - Loads the first entity of the given criteria, or returns null if none. *
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
query(
String sql, [dynamic values]) → Stream< Row> -
Queue a SQL query to be run, returning a Stream of rows.
override
-
queryAny(
String sql, [dynamic values]) → Future< Row?> - Returns the first result, or null if not found.
-
queryAnyBy(
Iterable< String> ? fields, String otype, Map<String, dynamic> whereValues, [AccessOption? option]) → Future<Row?> -
Queries
fields
ofotype
for the criteria specified in -
queryAnyWith(
Iterable< String> ? fields, String otype, String? whereClause, [Map<String, dynamic> ? whereValues, String? fromClause, String? shortcut, AccessOption? option]) → Future<Row?> - Returns the first result, or null if not found. *
-
queryBy(
Iterable< String> ? fields, String otype, Map<String, dynamic> whereValues, [AccessOption? option]) → Stream<Row> -
Queries
fields
ofotype
for the criteria specified in -
queryWith(
Iterable< String> ? fields, String otype, String? whereClause, [Map<String, dynamic> ? whereValues, String? fromClause, String? shortcut, AccessOption? option]) → Stream<Row> -
Queries
fields
ofotype
for the criteria specified in -
toEntity<
T extends Entity> (Row? row, Iterable< String> ? fields, T newInstance(String oid)) → T? -
Instantiates an Entity instance to represent the data in
row
. Ifrow
is null, this method will returnFuture.value(null)
. -
toEntityNS<
T extends Entity> (Row row, Iterable< String> ? fields, T newInstance(String oid)) → T -
Instantiates an Entity instance to represent the data in
row
. -
toString(
) → String -
A string representation of this object.
inherited
-
uncache(
String? otype, String? oid) → Entity? -
Removes the caching of the entity of the given
otype
andoid
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited