Learn R Programming

ChemmineR (version 2.24.2)

bufferResultSet: Buffer Query Results

Description

Allow query results to be processed in batches for efficiency.

Usage

bufferResultSet(rs, rsProcessor, batchSize = 1000,closeRS=FALSE)

Arguments

rs
A DBIResult object, usually from dbSendQuery.
rsProcessor
Each batch will be passed as a data frame to this function for processing.
batchSize
The number of rows to read in each batch
closeRS
Should the result set be closed by this function when it is done?

Value

No value.

Examples

Run this code
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (rs, rsProcessor, batchSize = 1000) 
{
    while (TRUE) {
        chunk = fetch(rs, n = batchSize)
        if (dim(chunk)[1] == 0) 
            break
        rsProcessor(chunk)
    }
  }

Run the code above in your browser using DataLab