Write a local data frame or file to the database.
# S4 method for MySQLConnection,character,data.frame
dbWriteTable(
conn,
name,
value,
field.types = NULL,
row.names = TRUE,
overwrite = FALSE,
append = FALSE,
...,
allow.keywords = FALSE
)# S4 method for MySQLConnection,character,character
dbWriteTable(
conn,
name,
value,
field.types = NULL,
overwrite = FALSE,
append = FALSE,
header = TRUE,
row.names = FALSE,
nrows = 50,
sep = ",",
eol = "\n",
skip = 0,
quote = "\"",
...
)
a MySQLConnection
object, produced by
dbConnect
a character string specifying a table name.
a data.frame (or coercible to data.frame) object or a
file name (character). In the first case, the data.frame is
written to a temporary file and then imported to SQLite; when value
is a character, it is interpreted as a file name and its contents imported
to SQLite.
character vector of named SQL field types where
the names are the names of new table's columns. If missing, types inferred
with dbDataType
).
A logical specifying whether the row.names
should be
output to the output DBMS table; if TRUE
, an extra field whose name
will be whatever the R identifier "row.names"
maps to the DBMS (see
make.db.names
). If NA
will add rows names if
they are characters, otherwise will ignore.
a logical specifying whether to overwrite an existing table
or not. Its default is FALSE
. (See the BUGS section below)
a logical specifying whether to append to an existing table
in the DBMS. Its default is FALSE
.
Unused, needs for compatibility with generic.
logical indicating whether column names that happen to be MySQL keywords be used as column names in the resulting relation (table) being written. Defaults to FALSE, forcing mysqlWriteTable to modify column names to make them legal MySQL identifiers.
logical, does the input file have a header line? Default is the
same heuristic used by read.table
, i.e., TRUE
if the first
line has one fewer column that the second line.
number of lines to rows to import using read.table
from
the input file to create the proper table definition. Default is 50.
field separator character
End-of-line separator
number of lines to skip before reading data in the input file.
the quote character used in the input file (defaults to
\"
.)