A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://majerr.github.io/sqlhelper/dev/articles/../reference/is_connected.html below:

Test whether a database is connected — is_connected • sqlhelper

Test whether a database is connected

Usage
is_connected(conn_name)

not_connected(conn_name)
Arguments
conn_name

Character. The name of a connection (run connection_info() for options)

Value

Logical, or NULL if conn_name does not identify exactly 1 connection

Examples
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