sqlQuery
is the workhorse function of RODBC. It sends the SQL
statement query
to the server, using connection channel
returned by odbcConnect
. SQL beginners should note that the term `Query' includes
any valid SQL statement including table creation, alteration, updates
etc as well as SELECTs. The sqlQuery
command is a convenience
wrapper that calls first odbcQuery
and then
sqlGetResults
. If finer-grained control is needed, for example
over the number of rows fetched, these functions should be called
directly or additional arguments passed to sqlQuery
.
sqlGetResults
is a mid-level function. It should be called
after a call to odbcQuery
and used to retrieve waiting
results into a dataframe. Its main use is with max
set to non
zero it will retrieve the result set in batches with repeated calls.
This is useful for very large result sets which can be subjected to
intermediate processing. It makes use of the setting of
options("dec")
to determine the character used in setting
decimal points. This is set to "."
when RODBC is initialized
if it is not already set.
Where possible sqlGetResults
transfers data directly: this
happens for double
, real
, integer
and
smallint
columns in the table. All other SQL data types are
converted to character strings (of length up to 256), and then converted
by type.convert
as controlled by the as.is
argument. Note that almost all callers set as.is = TRUE
.
Using buffsize
will yield a
marginal increase in speed if set to more than the maximum number of
rows where believeNRows = FALSE
.