SqlProvider class

数据库提供者。

Constructors

SqlProvider.instance()
factory

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

close() Future<void>
关闭
createTable(Table table) Future<List<Map<String, Object?>>>
创建表
delete(String tName, {String? where, List<Object?>? whereArgs}) Future<int>
删除表数据 Convenience method for deleting rows in the database.
deleteById(String tName, {required int id, String fieldId = UnitFields.id}) Future<int>
通过提供的ID删除数据
dropTable(String name) Future<List<Map<String, Object?>>>
删除表
execute(String sql) Future
执行Sql语句
exist(String dbName) Future<bool>
是否有数据存在
getPath(String dbName) Future<String>
获取存储路径
init(String dbName, {required List<Table> tables, bool? readonly}) Future<Database>
初始化数据库
insert(String tName, Map<String, Object?> object) Future<int>
插入表数据
insertObject<T extends TableObjectConvertible>(String tName, T object) Future<int>
插入表数据
isOpen() bool
判断数据库是否打开状态,即db不为空。
list() Future<List<FileSystemEntity>>
数据库目录列表
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String dbName, {bool? readonly}) Future<Database>
打开一个现有数据库
query(String tName, {bool? distinct, List<String>? columns, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) Future<List<Map<String, Object?>>>
查数据库
rawQuery(String sql, [List<Object?>? arguments]) Future<List<Map<String, Object?>>>
Executes a raw SQL SELECT query and returns a list of the rows that were found.
remove(String dbName) Future<bool>
删除数据库
show([String? name]) Future<List<Map<String, Object?>>>
查看表结构
tableExists(String table) Future<bool>
是否存在数据库表
toString() String
A string representation of this object.
inherited
update(String tName, Map<String, Object?> values, {String? where, List<Object?>? whereArgs, ConflictAlgorithm? conflictAlgorithm}) Future<int>
更新数据

Operators

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