Test whether a database is connected
Usageis_connected(conn_name)
not_connected(conn_name)
Arguments
Character. The name of a connection (run connection_info()
for options)
Logical, or NULL if conn_name
does not identify exactly 1 connection
library(sqlhelper)
connect(
system.file("examples/sqlhelper_db_conf.yml",
package="sqlhelper")
)
connection_info()
#> # A tibble: 2 × 7
#> name description live default driver conn_str pool
#> <chr> <chr> <lgl> <lgl> <glue> <chr> <lgl>
#> 1 pool_sqlite A pooled connection to an i… TRUE FALSE RSQLi… NA TRUE
#> 2 simple_sqlite A simple connection to an i… TRUE TRUE RSQLi… NA FALSE
is_connected("simple_sqlite")
#> [1] TRUE
is_connected("foo")
#> NULL
DBI::dbDisconnect(live_connection("simple_sqlite"))
is_connected("simple_sqlite")
#> [1] FALSE
not_connected("simple_sqlite")
#> [1] TRUE
disconnect()
is_connected("simple_sqlite")
#> NULL
not_connected("simple_sqlite")
#> NULL
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4