Connection.inMemory constructor

Connection.inMemory([
  1. Config? config
])

Implementation

Connection.inMemory([this.config]) {
  init();
  if (config != null) {
    setConfig();
    if (bindings.duckdb_open_ext(nullptr, ptrDb, ptrConfig.value, nullptr) ==
        duckdb_state.DuckDBError) {
      throw StateError('Error opening the Db');
    }
  } else {
    if (bindings.duckdb_open(nullptr, ptrDb) == duckdb_state.DuckDBError) {
      throw StateError('Error opening the Db');
    }
  }

  if (bindings.duckdb_connect(ptrDb.value, ptrCon) ==
      duckdb_state.DuckDBError) {
    throw StateError('Error connecting to the Db');
  }
}