insert_sql3: Function to insert values into db table

Description Usage Arguments Details

Description

By default, uses parameterized INSERT IGNORE statement with option to replace if exists.

Usage

1
2
3
4
5
6
7
8
9
insert_sql3(
  dataF,
  tName,
  replaceifexists = FALSE,
  Group = "EPA_harshadb",
  defaultFile = file.path(gfuns::sg("ws"), ".my.cnf"),
  verbose = FALSE,
  ...
)

Arguments

dataF

data frame to be appended

tName

table to appand data to

Group

Group identifier found in .my.cnf

defaultFile

file where Group credentials are found

verbose

provide feedback to user

Details

INSERT IGNORE will allow inserts if primary key does not exist and ignores inserts where it does preventing failure of statement when values exist. Note: REPLACE makes sense only if a table has a PRIMARY KEY or UNIQUE index. Otherwise, it becomes equivalent to INSERT, because there is no index to be used to determine whether a new row duplicates another. replaceifexists = TRUE is slower.


duanxd1/gfuns documentation built on March 7, 2020, 12:46 a.m.