Update: Update

Description Usage Arguments Value See Also Examples

View source: R/Update.R

Description

Convenience function to update tables of a SQLite database. For each row of the updates (data), the function looks for rows in the database table which have the same values as data for the columns defined in check. These rows are updated with the information of that data row.

Usage

1
Update(data, table, check, db, enforce_foreign_keys = TRUE)

Arguments

data

data.frame of data to be written into db table

table

chr of table name

check

chr of column name(s) for which updated rows have to have equal content

db

chr full file name with path of database

enforce_foreign_keys

bool (TRUE) whether to enforce rules on foreign keys

Value

TRUE if successful

See Also

Other SQLite handler functions: InsertBLOB, Insert, Intersect, SelectBLOB, Select, UpdateBLOB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
db <- "db/test.db"
Create_testDB(db)
df <- data.frame(
  id = 3:4, 
  owner = rep("test",2), 
  iban = rep("test",2), 
  bic = rep("test",2), 
  stringsAsFactors = FALSE
 )
Update(df, "accounts", "id", db)
Select("accounts", db, eq = list(id = c(3,4)))

mRcSchwering/abacus documentation built on May 21, 2019, 9:18 a.m.