db_createColumnDefinitions: helper function for db_createTable(): generates a column...

View source: R/dbAccess.R

db_createColumnDefinitionsR Documentation

helper function for db_createTable(): generates a column definitions list based on the column types (classes) of the data.frame

Description

helper function for db_createTable(): generates a column definitions list based on the column types (classes) of the data.frame

Usage

db_createColumnDefinitions(
  dataframe,
  dbType = "SQLite",
  dateAsInteger = FALSE,
  preferredText = "LONGTEXT",
  preferredBlob = "LONGBLOB"
)

Arguments

dataframe

data.frame which is to be written to a database using eg db_createTable()

dbType

currently only SQLite is a valid value

dateAsInteger

boolean, if FALSE the type "DATE" is used, otherwise "INTEGER" is used. This is to circumvent data type conventions

preferredText

character string specifying which text field type is to be used. Ignored when dbType = "SQLite"

preferredBlob

character string specifying which blob field type is to be used. Ignored when dbType = "SQLite"

Value

a cahracter list of column names/ column types for use as columnDefinitions in db_createTable()

Note

not all data types are in here yet, they will be added when needed

this function is experimental, may change in the future

DATE fields will come back as integer type in case of SQLite, use if as.Date(..., origin = "1970-01-01") to transform to proper dates

LOGICAL (BOOLEAN) fields will come back as integer type (0 FALSE,1 TRUE)


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.