database property

TDatabase? get database
inherited

Implementation

TDatabase? get database => _database;
  1. @override
set database (TDatabase? value)
override

Implementation

@override
set database(TDatabase? value) {
  if (!identical(value, database)) {
    if (value != null && value is! TSQLConnection) {
      databaseErrorFmt(SErrNotASQLConnection, [value.name], this);
    }
    checkInactive();
    if (_options.contains(TSQLTransactionOption.stoUseImplicit) &&
        value != null &&
        !(value as TSQLConnection)
            .connOptions
            .contains(TConnOption.sqImplicitTransaction)) {
      databaseErrorFmt(
          SErrNoImplicitTransaction, [value.runtimeType.toString()]);
    }
    if (database != null) {
      if (identical(sqlConnection!.transaction, this)) {
        sqlConnection!.transaction = null;
      }
    }
    super.database = value;
    if (database != null &&
        !componentState.contains(TComponentStateItem.csLoading)) {
      if (sqlConnection!.transaction == null) {
        sqlConnection!.transaction = this;
      }
    }
  }
}