FbDb class

Represents a database connection.

Every object of this cla/ to a Firebird database and is associated with a background To initialize the connection you should call attach or createDatabase, to close the connection call detach or dropDatabase (the latter physically removes the database file, so take extra care).

Example:

final db = await FbDb.attach(host: "localhost", database: "employee");
// work with the database here using the db attachment object
await db.detach();
// db cannot be used any more

For more details, please refer to the FbDb Programmer's Guide.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

blobFromFile({required FbBlobId id, required File file}) Future<void>
Fills a blob with data from the provided file.
blobToFile({required FbBlobId id, required File file, int segmentSize = 4096}) Future<void>
Save the data from a blob to a file.
closeBlob({required FbBlobId id}) Future<void>
Closes a previously created or opened blob.
commit({FbTransaction? transaction}) Future<void>
Commits an explicit transaction.
createBlob({FbTransaction? inTransaction}) Future<FbBlobId>
Creates a new blob in the database.
detach() Future<void>
Closes the database connection.
dropDatabase() Future<void>
Physically removes the currently attached database.
execute({required String sql, List parameters = const [], bool inlineBlobs = true, bool returnAffectedRows = false, FbTransaction? inTransaction}) Future<int>
Utility method - executes a query which doesn't return any data.
inTransaction({FbTransaction? transaction}) Future<bool>
Checks if an explicit transaction is currently pending.
newTransaction({Set<FbTrFlag>? flags, int? lockTimeout}) Future<FbTransaction>
Start a new concurrent, explicit transaction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openBlob({required FbBlobId id, int segmentSize = 4096, FbTransaction? inTransaction}) Future<Stream<ByteBuffer>>
Opens an existing blob for reading.
ping() Future<bool>
Checks if a connection is valid.
putBlobFromStream({required FbBlobId id, required Stream<ByteBuffer> stream}) Future<void>
Fills a blob with data from the provided stream.
putBlobSegment({required FbBlobId id, required ByteBuffer data}) Future<void>
Sends a data segment of a blob to the database.
putBlobSegmentStr({required FbBlobId id, required String data}) Future<void>
Sends a string as a blob's data segment to the database.
query() FbQuery
Creates a new query object associated with this connection.
rollback({FbTransaction? transaction}) Future<void>
Rolls back en explicit transaction.
runInTransaction<T>(Future<T?> toRun(), {bool rethrowException = true}) Future<T?>
Utility method - execute a sequence of statements in a transaction.
selectAll({required String sql, List parameters = const [], bool inlineBlobs = true, FbTransaction? inTransaction}) Future<List<Map<String, dynamic>>>
Utility method - selects all rows and reurns then as a list of maps.
selectOne({required String sql, List parameters = const [], bool inlineBlobs = true, FbTransaction? inTransaction}) Future<Map<String, dynamic>?>
Utility method - selects a single row and reurns it as a map.
startTransaction({Set<FbTrFlag>? flags, int? lockTimeout}) Future<void>
Starts an explicit transaction.
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

attach({String? host, int? port, required String database, String? user, String? password, String? role, FbOptions? options}) Future<FbDb>
Creates a connection to an existing database.
createDatabase({String? host, int? port, required String database, String? user, String? password, String? role, FbOptions? options}) Future<FbDb>
Attempts to create a new database and connect to it.