Adbi driver
Source:R/AdbiDriver.R, R/dbConnect_AdbiDriver.R, R/dbDisconnect_AdbiConnection.R
dbConnect.RdIn order to open a database connection, DBI::dbConnect() dispatches on a
driver object, which can be instantiated by calling adbi().
Usage
adbi(driver = NA_character_)
# S4 method for class 'AdbiDriver'
dbConnect(drv, ..., bigint = NULL)
# S4 method for class 'AdbiConnection'
dbDisconnect(conn, force = getOption("adbi.force_close_results", FALSE), ...)Arguments
- driver
A driver specification that can be evaluated (with no arguments) to give an
adbcdrivermanager::adbc_driver(). See Details for more information.- drv
An object that inherits from DBI::DBIDriver, or an existing DBI::DBIConnection object (in order to clone an existing connection).
- ...
Extra arguments passed to
DBI::dbConnect()are forwarded toadbcdrivermanager::adbc_database_init()- bigint
The R type that 64-bit integer types should be mapped to, default is bit64::integer64, if bit64 is installed and
characterotherwise- conn
A DBI::DBIConnection object, as returned by
DBI::dbConnect().- force
Close open results when disconnecting
Value
A connection object (S4 class AdbiCOnnection, inheriting from
DBI::DBIConnection) is returned by DBI::dbConnect(), while
DBI::dbDisconnect() returns TRUE invisibly.
Details
To specify the type of adbc driver, adbi accepts as driver argument
an object inheriting from
adbc_driver,a function that can be evaluated with no arguments and returns an object inheriting from
adbc_driver,a string of the form
pkg::fun(wherepkg::is optional and defaults tofun), which can be used to look up such a function.
As default, an adbcdrivermanager::adbc_driver_monkey() object is created.
Examples
adbi()
#> <AdbiDriver>
#> Type: <adbc_driver_monkey>
if (requireNamespace("adbcsqlite")) {
adbi("adbcsqlite")
}
#> Loading required namespace: adbcsqlite
#> <AdbiDriver>
#> Type: <adbcsqlite_driver_sqlite>
library(DBI)
con <- dbConnect(adbi())
dbIsValid(con)
#> [1] TRUE
dbDisconnect(con)
dbIsValid(con)
#> [1] FALSE