access
library
Properties
accessCount
→ int
Returns the number of accesses being executing.
no setter
onAccess
↔ (void Function(FutureOr command (DBAccess access ), int accessCount ) ?)
A callback, if specified, is called before starting an access
(aka., a transaction).
getter/setter pair
Functions
access <T > (FutureOr <T > command (DBAccess access ) )
→ Future <T >
Executes a command within a transaction.
addSqlColumns (StringBuffer sql , Iterable <String > ? fields , [String ? shortcut ])
→ void
Adds a list of fields
into sql
by separating them with comma
See also sqlColumns .
configure (Pool pool , {Duration ? slowSqlThreshold , void onSlowSql (Map <String , dynamic > dataset , Duration timeSpent , String sql , dynamic values )?, FutureOr onPreSlowSql (Connection conn , Map <String , dynamic > dataset , String message )?, void onQuery (String sql , dynamic values )?, void onExecute (String sql , dynamic values )?, String getErrorMessage (String sql , dynamic values )?, bool shallLogError (DBAccess access , String sql , Object ex )? })
→ Pool?
Configures the access library.
firstColumns (Iterable <Row > rows )
→ List
Collects the first column of Row into a list.
inList (Iterable ? value )
→ InCondition
Used in the whereValues
of DBAccess.loadBy , DBAccess.queryBy ,
and sqlWhereBy to indicate an IN clause.
That is, it shall be generated with field in (value1, value2)
isForeignKeyViolation (dynamic ex )
→ bool
Whether it is PostgresqlException about the violation of foreign keys.
isNotNullViolation (dynamic ex )
→ bool
Whether it is PostgresqlException about the violation of foreign keys.
isUniqueViolation (dynamic ex )
→ bool
Whether it is PostgresqlException about the violation of uniqueness.
It is useful with select-for-update
isViolation (dynamic ex , String code )
→ bool
Whether it is PostgresqlException about the violation of the given code
.
like (String pattern , [String ? escape ])
→ LikeCondition
Used in the whereValues
of DBAccess.loadBy , DBAccess.queryBy ,
and sqlWhereBy to indicate a LIKE clause.
That is, it shall be generated with field in (value1, value2)
not <T > (T value )
→ NotCondition <T >
Used in the whereValues
of DBAccess.loadBy , DBAccess.queryBy ,
and sqlWhereBy to indicate a field shall not be the given value,
so-called negative condition.
notIn (Iterable ? value )
→ NotCondition <InCondition >
Used in the whereValues
of DBAccess.loadBy , DBAccess.queryBy ,
and sqlWhereBy to indicate a NOT IN clause.
notLike (String pattern , [String ? escape ])
→ NotCondition <LikeCondition >
Used in the whereValues
of DBAccess.loadBy , DBAccess.queryBy ,
and sqlWhereBy to indicate a NOT Like clause.
sqlColumns (Iterable <String > ? fields , [String ? shortcut ])
→ String
Converts a list of fields
to a SQL fragment separated by comma.
sqlWhereBy (Map <String , dynamic > whereValues , [String ? append ])
→ String
Returns the where criteria (without where) by concatenating all values
found in whereValues
with and .