Insert row(s) into table

dbInsert(
  db,
  table = NULL,
  vals,
  schema = schemas[[table]],
  schemas = get.db.schemas(db),
  sql = NULL,
  run = TRUE,
  mode = c("insert", "replace")[1],
  add.missing.cols = TRUE,
  rclass = schema$rclass,
  convert = !is.null(rclass),
  primary.key = schema$primary_key,
  get.key = FALSE,
  null.as.na = TRUE,
  log.dir = NULL,
  do.log = !is.null(log.dir),
  user = NA
)

Arguments

db

dbi database connection

table

name of the table

vals

named list of values to be inserted

schema

a table schema that can be used to convert values

sql

optional a parameterized sql string

run

if FALSE only return parametrized SQL string

mode

"insert" or "replace", should have no effect so far

add.missing.cols

if TRUE (default) and a schema is provided than automatically add database columns that are missing in vals and set them NA.

rclass

the r class of the table columns, is extracted from schema

convert

if rclass is given shall results automatically be converted to these classes?

primary.key

name of the primary key column (if the table has one)

get.key

if TRUE return the created primary key value