bufferResultSet: Buffer Query Results

Description Usage Arguments Value Author(s) Examples

View source: R/compound_db.R

Description

Allow query results to be processed in batches for efficiency.

Usage

1
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.

Author(s)

Kevin Horan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##-- ==>  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)
    }
  }

ChemmineR documentation built on Feb. 28, 2021, 2:02 a.m.