Learn R Programming

RSQLite (version 1.0.0)

make.db.names,SQLiteConnection,character-method: Make R/S-Plus identifiers into legal SQL identifiers

Description

These methods are straight-forward implementations of the corresponding generic functions.

Usage

# S4 method for SQLiteConnection,character
make.db.names(dbObj, snames,
  keywords = .SQL92Keywords, unique = TRUE, allow.keywords = TRUE, ...)

# S4 method for SQLiteConnection SQLKeywords(dbObj, ...)

# S4 method for SQLiteConnection,character isSQLKeyword(dbObj, name, keywords = .SQL92Keywords, case = c("lower", "upper", "any")[3], ...)

Arguments

dbObj

any SQLite object (e.g., SQLiteDriver).

snames

a character vector of R identifiers (symbols) from which to make SQL identifiers.

keywords

a character vector with SQL keywords, namely .SQL92Keywords defined in the DBI package.

unique

logical describing whether the resulting set of SQL names should be unique. The default is TRUE. Following the SQL 92 standard, uniqueness of SQL identifiers is determined regardless of whether letters are upper or lower case.

allow.keywords

logical describing whether SQL keywords should be allowed in the resulting set of SQL names. The default is TRUE.

...

Not used. Included for compatiblity with generic.

name

a character vector of SQL identifiers we want to check against keywords from the DBMS.

case

a character string specifying whether to make the comparison as lower case, upper case, or any of the two. it defaults to "any".

Examples

Run this code
# NOT RUN {
# This example shows how we could export a bunch of data.frames
# into tables on a remote database.

con <- dbConnect("SQLite", dbname = "sqlite.db")

export <- c("trantime.email", "trantime.print", "round.trip.time.email")
tabs <- make.db.names(con, export, unique = TRUE, allow.keywords = TRUE)

for(i in seq_along(export) )
   dbWriteTable(con, name = tabs[i],  get(export[i]))
# }

Run the code above in your browser using DataLab