-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathsqlCreateTable.Rd
More file actions
68 lines (56 loc) · 2.17 KB
/
Copy pathsqlCreateTable.Rd
File metadata and controls
68 lines (56 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/table-create.R
\name{sqlCreateTable}
\alias{sqlCreateTable}
\title{Compose query to create a simple table}
\usage{
sqlCreateTable(
con,
table,
fields,
row.names = NA,
temporary = FALSE,
...,
pk = NULL
)
}
\arguments{
\item{con}{A database connection.}
\item{table}{Name of the table. Escaped with
\code{\link[=dbQuoteIdentifier]{dbQuoteIdentifier()}}.}
\item{fields}{Either a character vector or a data frame.
A named character vector: Names are column names, values are types.
Names are escaped with \code{\link[=dbQuoteIdentifier]{dbQuoteIdentifier()}}.
Field types are unescaped.
A data frame: field types are generated using
\code{\link[=dbDataType]{dbDataType()}}.}
\item{row.names}{Either \code{TRUE}, \code{FALSE}, \code{NA} or a string.
If \code{TRUE}, always translate row names to a column called "row_names".
If \code{FALSE}, never translate row names. If \code{NA}, translate
rownames only if they're a character vector.
A string is equivalent to \code{TRUE}, but allows you to override the
default name.
For backward compatibility, \code{NULL} is equivalent to \code{FALSE}.}
\item{temporary}{If \code{TRUE}, will generate a temporary table statement.}
\item{...}{Other arguments used by individual methods.}
\item{pk}{Primary key columns.
For some DBMS this must be specified at creation time.
Even if not strictly necessary, it may save substantial processing time later on.
This argument is processed with \code{\link[=dbQuoteIdentifier]{dbQuoteIdentifier()}}.}
}
\description{
Exposes an interface to simple \verb{CREATE TABLE} commands. The default
method is ANSI SQL 99 compliant.
This method is mostly useful for backend implementers.
}
\details{
The \code{row.names} argument must be passed explicitly in order to avoid
a compatibility warning. The default will be changed in a later release.
}
\examples{
sqlCreateTable(ANSI(), "my-table", c(a = "integer", b = "text"))
sqlCreateTable(ANSI(), "my-table", iris)
# By default, character row names are converted to a row_names colum
sqlCreateTable(ANSI(), "mtcars", mtcars[, 1:5])
sqlCreateTable(ANSI(), "mtcars", mtcars[, 1:5], row.names = FALSE)
}