Skip to contents

Create R-Function Interface to Database

Usage

createRDatabaseInterface(
  db = NULL,
  dbSchema = NULL,
  tableNamePattern = "",
  functionPrefix = "db_",
  pattern = "^",
  rfile = file.path(tempdir(), "dbInterface.R"),
  rfile.create = file.path(tempdir(), "dbInterfaceCreate.R"),
  create.create.functions = FALSE,
  dbg = TRUE,
  sql.dbg = TRUE
)

Arguments

db

name of ODBC data source or full path to MS Access or Excel file

dbSchema

list structure describing the database schema, as returned by kwb.odm::dbSchema_ODM()

tableNamePattern

pattern matching the names of tables/views for which an accessor function is to be generated

functionPrefix

prefix to be given to each generated function. Default: "db_"

pattern

pattern matching the part of the table name that will be replaced with functionPrefix. Default: "^", i.e. the prefix will be appended to the start of the table name

rfile

full path to the file in which to store the data access functions

rfile.create

full path to the file in which to store the data creation functions (only relevant if crete.create.functions is TRUE)

create.create.functions

logical. If TRUE (the default if FALSE) not only data access but also data creation functions are generated

dbg

if TRUE, progress messages are shown during the creation of the interface functions

sql.dbg

if TRUE, SQL strings used to access the database are shown when calling the interface functions