DBInterface class abstract

For a demonstration, class SQLiteDB implements DBInterface

Implementers

Constructors

DBInterface()

Properties

db → dynamic
Database object
no setter
error ↔ Exception?
Contains the last exception if any
getter/setter pair
fields → Map<String, List<String>>
Contains a list of columns of each table
no setter
hashCode → int
The hash code for this object.
no setterinherited
inError → bool
Indicate if there was a recent Database error
no setter
isDatabaseClosedError → bool
Was there a 'Database Closed' error
no setter
isDatabaseException → bool
Was there a 'Database Exception' error
no setter
isNoSuchTableError → bool
Was there a 'No Such Table' error
no setter
isOpenFailedError → bool
Was there a 'Open Failed' error
no setter
isReadOnlyError → bool
Was there a 'ReadOnly' error
no setter
isSyntaxError → bool
Was there a 'Syntax' error
no setter
isUniqueConstraintError → bool
Was there a 'Unique Constraint' error
no setter
message → String
Return any SQL or Database error message
no setter
name → String
Name of the database
no setter
newrec → Map<String, Map<String, dynamic>>
Create a new 'empty' record from a specified data table
no setter
noError → bool
Returns true if there was not an error recently.
no setter
recsUpdated → int?
The of records updated in the last Database operation
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
version → int
Current Database version number Update with any data tables changes.
no setter

Methods

close() → void
Close the Database
delete(String table, int id) → Future<int>
Delete a data table's record by its primary key Returns the number of records effected.
deleteRec(String table, {String? where, List? whereArgs}) → Future<int>
Delete the specified record by using a where clause from the specified data table
disposed() → void
Called in a State object's dispose() function. Usually call close() function to close the Database. Leave the word 'dispose' to subclasses. gp
getRecord(String table, int id) → Future<List<Map<String, dynamic>>>
Return a specific record by primary key from a specified data table
getRow(String table, int id, Map<String, dynamic> fields) → Future<List<Map<String, dynamic>>>
Return the specified fields from a specified record by primary key from a specified data table
getTable(String table, {bool? distinct, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) → Future<List<Map<String, dynamic>>>
Return a List of records from a specified data table.
init() → Future<bool>
Called in the initState() function or the FutureBuilder(future: parameter Usually calls the open() function to open the Database
keyField(String table) → Future<String?>
Return the primary key name from the specified data table
mapQuery(List<Map<String, dynamic>> query) → List<Map<String, dynamic>>
Return a List of records from a query result
newRec(String table, [Map<String, dynamic>? data]) → Map<String?, dynamic>
Create a new 'empty' record from a specified data table Specified the fields to come from the data table
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() → Future<bool>
Opens the Database
query(String table, {List<String>? columns, bool? distinct, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) → Future<List<Map<String, dynamic>>>
Returns a list of record from the specified data table based on its where clause
rawDelete(String sqlStmt, [List<Object?>? arguments]) → Future<int>
Executes a raw SQL DELETE query and returns the number of changes made.
rawInsert(String sqlStmt, [List<Object?>? arguments]) → Future<int>
Executes a raw SQL INSERT query and returns the last inserted row ID.
rawQuery(String sqlStmt) → Future<List<Map<String, dynamic>>>
Executes a raw SQL SELECT query and returns a list of the rows that were found.
rawUpdate(String sqlStmt, [List<Object?>? arguments]) → Future<int>
Executes a raw SQL UPDATE query and returns the number of changes made.
runTxn<T>(T func()) → Future<T>
Initiate a Database transaction All sequences are rolled back in one among them fails.
saveMap(String? table, Map<String, dynamic>? values) → Future<Map<String, dynamic>>
Save the specified record values to the specified data table Either parameters may be null
saveRec(String table, Map<String, dynamic> fldValues) → Future<Map<String, dynamic>>
Save the specified record values to the specified data table Neither parameters can be null
tableColumns(String table) → Future<List<Map<String, dynamic>>>
Return the field names of the specified data table
tableNames() → Future<List<Map<String, dynamic>>>
Return a list of data tables in the Database
toString() → String
A string representation of this object.
inherited
updateRec(String table, Map<String, dynamic> fields) → Future<Map<String, dynamic>>
Update the specified record from the specified data table

Operators

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