Opens a connection to a database you have already set up with
episodic_db_create(), with the settings EpiSODIC needs enabled (for
SQLite: WAL journal mode, a busy timeout, and foreign key enforcement).
Remember to disconnect with DBI::dbDisconnect() when you are done.
Arguments
- path
Path to an existing SQLite file, or a
mysql://DSN (seeepisodic_db_dsn_mariadb()) pointing at an existing MariaDB/MySQL database.- check_schema_version
Whether to refuse a database whose schema version is not the one this build of EpiSODIC expects, with an error naming
episodic_db_migrate()as the fix.TRUE(the default) everywhere except insideepisodic_db_migrate()itself, which by definition has to open a database that is out of date.
Value
An open DBI::DBIConnection.
Examples
db_path <- tempfile(fileext = ".sqlite")
con <- episodic_db_create(db_path)
DBI::dbDisconnect(con)
con <- episodic_db_connect(db_path)
DBI::dbDisconnect(con)
file.remove(db_path)
#> [1] TRUE