-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathdbExecute-DatabaseConnectorDbiConnection-character-method.Rd
More file actions
80 lines (75 loc) · 2.95 KB
/
Copy pathdbExecute-DatabaseConnectorDbiConnection-character-method.Rd
File metadata and controls
80 lines (75 loc) · 2.95 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
69
70
71
72
73
74
75
76
77
78
79
80
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/DBI.R
\name{dbExecute,DatabaseConnectorDbiConnection,character-method}
\alias{dbExecute,DatabaseConnectorDbiConnection,character-method}
\title{Change database state}
\usage{
\S4method{dbExecute}{DatabaseConnectorDbiConnection,character}(conn, statement, ...)
}
\arguments{
\item{conn}{A \link[DBI:DBIConnection-class]{DBIConnection} object, as returned by
\code{\link[DBI:dbConnect]{dbConnect()}}.}
\item{statement}{a character string containing SQL.}
\item{...}{Other parameters passed on to methods.}
}
\value{
\code{dbExecute()} always returns a
scalar
numeric
that specifies the number of rows affected
by the statement.
}
\description{
Executes a statement and returns the number of rows affected.
\code{dbExecute()} comes with a default implementation
(which should work with most backends) that calls
\code{\link[DBI:dbSendStatement]{dbSendStatement()}}, then \code{\link[DBI:dbGetRowsAffected]{dbGetRowsAffected()}}, ensuring that
the result is always freed by \code{\link[DBI:dbClearResult]{dbClearResult()}}.
For passing query parameters, see \code{\link[DBI:dbBind]{dbBind()}}, in particular
the "The command execution flow" section.
\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbExecute")}
}
\details{
You can also use \code{dbExecute()} to call a stored procedure
that performs data manipulation or other actions that do not return a result set.
To execute a stored procedure that returns a result set,
or a data manipulation query that also returns a result set
such as \verb{INSERT INTO ... RETURNING ...}, use \code{\link[DBI:dbGetQuery]{dbGetQuery()}} instead.
}
\seealso{
For queries: \code{\link[DBI:dbSendQuery]{dbSendQuery()}} and \code{\link[DBI:dbGetQuery]{dbGetQuery()}}.
Other DBIConnection generics:
\code{\link[DBI]{DBIConnection-class}},
\code{\link[DBI]{dbAppendTable}()},
\code{\link[DBI]{dbAppendTableArrow}()},
\code{\link[DBI]{dbCreateTable}()},
\code{\link[DBI]{dbCreateTableArrow}()},
\code{\link[DBI]{dbDataType}()},
\code{\link[DBI]{dbDisconnect}()},
\code{\link[DBI]{dbExistsTable}()},
\code{\link[DBI]{dbGetException}()},
\code{\link[DBI]{dbGetInfo}()},
\code{\link[DBI]{dbGetQuery}()},
\code{\link[DBI]{dbGetQueryArrow}()},
\code{\link[DBI]{dbIsReadOnly}()},
\code{\link[DBI]{dbIsValid}()},
\code{\link[DBI]{dbListFields}()},
\code{\link[DBI]{dbListObjects}()},
\code{\link[DBI]{dbListResults}()},
\code{\link[DBI]{dbListTables}()},
\code{\link[DBI]{dbQuoteIdentifier}()},
\code{\link[DBI]{dbReadTable}()},
\code{\link[DBI]{dbReadTableArrow}()},
\code{\link[DBI]{dbRemoveTable}()},
\code{\link[DBI]{dbSendQuery}()},
\code{\link[DBI]{dbSendQueryArrow}()},
\code{\link[DBI]{dbSendStatement}()},
\code{\link[DBI]{dbUnquoteIdentifier}()},
\code{\link[DBI]{dbWriteTable}()},
\code{\link[DBI]{dbWriteTableArrow}()}
Other command execution generics:
\code{\link[DBI]{dbBind}()},
\code{\link[DBI]{dbClearResult}()},
\code{\link[DBI]{dbGetRowsAffected}()},
\code{\link[DBI]{dbSendStatement}()}
}