DBSQLiteAdapter.fromConfig constructor
DBSQLiteAdapter.fromConfig(
- Map<
String, dynamic> ? config, { - String? defaultDatabasePath,
- EntityRepositoryProvider? parentRepositoryProvider,
- String? workingPath,
Implementation
factory DBSQLiteAdapter.fromConfig(
Map<String, dynamic>? config, {
String? defaultDatabasePath,
EntityRepositoryProvider? parentRepositoryProvider,
String? workingPath,
}) {
boot();
var memory = config?['memory'] ?? config?['inMemory'];
String? path =
(config?['path'] ??
config?['file'] ??
config?['database'] ??
config?['db'] ??
defaultDatabasePath)
?.toString();
if (memory == true || (path == null && memory != false)) {
path = sqliteMemoryPath;
}
if (path == null) throw ArgumentError.notNull('path');
int? busyTimeout =
config?['busyTimeout'] ??
config?['busy-timeout'] ??
config?['busy_timeout'];
var (generateTables: generateTables, checkTables: checkTables) =
DBSQLAdapter.parseConfigDBGenerateTablesAndCheckTables(config);
var populate = config?['populate'];
Object? populateTables;
Object? populateSource;
Object? populateSourceVariables;
if (populate is Map) {
populateTables = populate['tables'];
populateSource = populate['source'];
populateSourceVariables = populate['variables'];
}
var logSql = DBSQLAdapter.parseConfigLogSQL(config) ?? false;
return DBSQLiteAdapter(
path,
busyTimeout: busyTimeout,
generateTables: generateTables,
checkTables: checkTables,
populateTables: populateTables,
populateSource: populateSource,
populateSourceVariables: populateSourceVariables,
parentRepositoryProvider: parentRepositoryProvider,
workingPath: workingPath,
logSQL: logSql,
);
}