DBSQLiteAdapter constructor

DBSQLiteAdapter(
  1. String databasePath, {
  2. int? busyTimeout,
  3. int minConnections = 1,
  4. int maxConnections = 3,
  5. bool preparedStatements = true,
  6. int preparedStatementsCacheSize = DBSQLAdapter.defaultPreparedStatementsCacheSize,
  7. bool generateTables = false,
  8. bool checkTables = true,
  9. Object? populateTables,
  10. Object? populateSource,
  11. Object? populateSourceVariables,
  12. EntityRepositoryProvider? parentRepositoryProvider,
  13. String? workingPath,
  14. bool logSQL = false,
})

Implementation

DBSQLiteAdapter(
  String databasePath, {
  int? busyTimeout,
  int minConnections = 1,
  int maxConnections = 3,
  this.preparedStatements = true,
  this.preparedStatementsCacheSize =
      DBSQLAdapter.defaultPreparedStatementsCacheSize,
  super.generateTables,
  super.checkTables,
  super.populateTables,
  super.populateSource,
  super.populateSourceVariables,
  super.parentRepositoryProvider,
  super.workingPath,
  super.logSQL,
}) : databasePath = databasePath,
     inMemory = _isMemoryPath(databasePath),
     busyTimeout = busyTimeout ?? 5000,
     super(
       'sqlite',
       minConnections,
       maxConnections,
       DBSQLAdapterCapability(
         dialect: const SQLDialect(
           'SQLite',
           elementQuote: '"',
           acceptsReturningSyntax: true,
           // SQLite rejects `RETURNING "alias".*`:
           // "RETURNING may not use TABLE.* wildcards".
           returningAcceptsTableWildcard: false,
           acceptsInsertDefaultValues: true,
           // `INSERT IGNORE` is MySQL-only; SQLite uses `ON CONFLICT`:
           acceptsInsertIgnore: false,
           acceptsInsertOnConflict: true,
           acceptsVarcharWithoutMaximumSize: true,
           // SQLite does NOT create an implicit index for a foreign key:
           foreignKeyCreatesImplicitIndex: false,
           createIndexIfNotExists: true,
           // SQLite can't `ALTER TABLE ... ADD CONSTRAINT`:
           alterTableAddConstraint: false,
           // Nor `ALTER TABLE ... ADD COLUMN IF NOT EXISTS`:
           alterTableAddColumnIfNotExists: false,
           // SQLite can't parse an `OFFSET` without a preceding `LIMIT`,
           // and uses `LIMIT -1` as "no limit":
           offsetRequiresLimit: true,
           offsetMaxLimitValue: '-1',
           // Parameters cost the same per ID as values, and a reused
           // statement saves its compilation (~10–15%); beyond ~1024 IDs,
           // a (padded) length seldom repeats (at most 32766 parameters):
           maxIDsAsParameters: 1024,
         ),
         transactions: true,
         transactionAbort: true,
         tableSQL: true,
         // SQLite can't `ALTER TABLE ... ADD CONSTRAINT`:
         constraintSupport: false,
         // A `sqlite3` handle can't be shared with another isolate:
         multiIsolateSupport: false,
         connectivity: DBAdapterCapabilityConnectivity.none,
       ),
     ) {
  boot();

  if (preparedStatements) {
    PreparedStatementsCache.checkMaxSize(
      preparedStatementsCacheSize,
      'preparedStatementsCacheSize',
    );
  }

  parentRepositoryProvider?.notifyKnownEntityRepositoryProvider(this);
}