db_connector: Creates function that checks for an existing DB connection...

Description Usage Arguments

Description

Creates function that checks for an existing DB connection and creates/open a new one if its not found open

Usage

1
2
db_connector(con_name, def_driver, checker = con_checker(con_name =
  con_name), def_args = NULL, def_args_nse = TRUE)

Arguments

con_name

name of the connection

def_driver

default DBI driver

checker

function that can check the connection (returns TRUE or FALSE)

def_args

list of default arguments (such as connection parameters, user name etc...) - see details

def_args_nse

if TRUE (default) arguments in def_args get evaluated every time the new connector function is called. This prevents situations when e.g. connector asks for a password and gets incorrect passwrod. Connectors created by db_connector() evaluates default arguments for the first time it is called and stores them (including the incorrect password) in the closure environment of the connector function and every new call of the connector no longer asks for password.


vh-d/dbcon documentation built on May 12, 2019, 6:26 p.m.