Skip to contents

Initializes the connector for DBI type of storage. See ConnectorDBI for details.

Usage

connector_dbi(drv, ..., extra_class = NULL)

Arguments

drv

Driver object inheriting from DBI::DBIDriver.

...

Additional arguments passed to DBI::dbConnect().

extra_class

character Extra class to assign to the new connector.

Value

A new ConnectorDBI object

Details

The extra_class parameter allows you to create a subclass of the ConnectorDBI object. This can be useful if you want to create a custom connection object for easier dispatch of new s3 methods, while still inheriting the methods from the ConnectorDBI object.

Examples

if (FALSE) {

# Create DBI connector
cnt <- connector_dbi(RSQLite::SQLite(), ":memory:")
cnt

# Create subclass connection
cnt_subclass <- connector_dbi(RSQLite::SQLite(), ":memory:",
  extra_class = "subclass"
)
cnt_subclass
class(cnt_subclass)
}