odbc {RODBC}R Documentation

Low-level ODBC functions

Description

R functions which talk directly to the ODBC interface.

Usage

odbcTables(channel)

odbcColumns(channel, table)
odbcPrimaryKeys(channel, table)

odbcQuery(channel, query, rows_at_time = 1)
odbcFetchRows(channel, max = 0, buffsize = 1000, nullstring = NA,
              believeNRows = TRUE) 

Arguments

channel connection handle as returned by odbcConnect() of class "RODBC".
query any valid SQL statement
table a database table name accessible from the connected dsn. This can be either a character string or an (unquoted) symbol.
rows_at_time The number of rows to fetch at a time, up to 1024. Not all drivers work correctly with values > 1: see sqlQuery.
max limit on the number of rows to fetch, with 0 indicating no limit.
buffsize the number of records to be transferred at a time.
nullstring character string to be used when reading SQL_NULL_DATA items from the database.
believeNRows logical. Is the number of rows returned by the ODBC connection believable? Not true for Oracle, apparently.

Details

odbcFetchRows returns a data frame of the pending rowset in $data limited to max rows if max is greater than 0. buffsize may be increased from the default of 1000 rows for increased performance in a large dataset. This only has an effect with servers that do not return the number of rows affected by a query e.g. MS Access, MS SQLServer.

Value

Most return 1 on success and -1 on failure, indicating that a message is waiting for odbcGetErrMsg. odbcFetchRows may return -2 indicating "No Data", the message that would be returned by odbcGetErrMsg.

Author(s)

Michael Lapsley and Brian Ripley

See Also

sqlQuery, odbcConnect, odbcGetErrMsg.


[Package RODBC version 1.1-9 Index]