| OraPreparedStatement-class {ROracle} | R Documentation |
A class that encapsulates the information on an Oracle prepared statement
Use the method dbPrepareStatement to create an Oracle
prepared statement and dbExecStatement to re-bind new
data and execute the cached statement.
Id:
Class "DBIPreparedStatement", directly.
Class "OraResult", directly.
Class "DBIObject", by class "DBIPreparedStatement".
Class "DBIResult", by class "OraResult".
Class "OraObject", by class "OraResult".
Class "dbObjectId", by class "OraResult".
signature(ps = "OraPreparedStatement", data = "data.frame"):
executes a prepared statement re-binding new data to it.
signature(dbObj = "OraPreparedStatement"):
returns a list of metadata associated with the prepared statement.
signature(object = "OraPreparedStatement"):
writes a brief summary of the status of the prepared statement.
Oracle's prepared statements (like other RDBMS') are SQL statements
that are parsed and cached to increase performance
when the SQL code is to be executed repeatedly but with different data;
for instance when inserting the rows of a data.frame into a table
the SQL for each row is exactly the same, only the row data changes.
The function dbPrepareStatement creates objects that
extend the base class DBIPreparedStatement.
These objects are simple references into C structures that store
the various aspects (the text of the SQL statement, sets of buffers
for transferring data back and forth, etc).
The function dbExecStatement takes a prepared statement
object and a data.frame and binds one or more of its columns to
the RDBMS table or object according to the specification in the prepared
statement.
As of the DBI version 0.1-5 prepared statements are not part of the R/S Database Interface definition (DBI).
See the Database Interface definition document
DBI.pdf in the base directory of this package
or http://stat.bell-labs.com/RS-DBI.
DBI classes:
OraObject-class
OraDriver-class
OraConnection-class
OraResult-class
OraPreparedStatement-class
## Not run:
ora <- dbDriver("Oracle")
con <- dbconnect(ora, "user/password")
ps <- dbPrepareStatement(con,
"INSERT into QUAKES (lat, long_1) VALUES (:1, :2)",
bind = c("numeric", "numeric"))
dbExecStatement(ps, quakes)
dbCommit(con)
## End(Not run)