Skip to content

RMySQL fetch defaults to N=500?

4 messages · Jay Pfaffman, Jens Nieschulze, David James

#
It appears that fetch() gets only the first 500 rows by default.  I
don't see this in the documentation, but 

    timeinfo <- fetch(rs)

gets only 500 rows where

    timeinfo <- fetch(rs,n=-1)

gets (correctly) 736 for the same query.  Is this an undocumented
feature?  I played with this data for an alarming amount of time
before I realized that I was missing a third of the data.  I appear to
be using version 0.4-5.  I'll upgrade to 0.4-6 Real Soon Now.  My
first attempt failed for some reason.
#
On Thu, 8 Aug 2002, Jay Pfaffman wrote:
%It appears that fetch() gets only the first 500 rows by default.  I
%don't see this in the documentation, but 

it is not in ?fetch
but
MySQLManager id = (5649) 
  Driver name:  MySQL 
  Max  connections: 10 
  Conn. processed: 1 
  Default records per fetch: 500 
  Open connections: 1 

where manager is your the output of dbManager("MySQL")
reveals some info


%    timeinfo <- fetch(rs)
%
%gets only 500 rows where
%
%    timeinfo <- fetch(rs,n=-1)
%
%gets (correctly) 736 for the same query.  Is this an undocumented
%feature?  I played with this data for an alarming amount of time
%before I realized that I was missing a third of the data.  I appear to
%be using version 0.4-5.  I'll upgrade to 0.4-6 Real Soon Now.  My
%first attempt failed for some reason.

undocumented? err, you can always look up the sources and in 
RMySQL.R (version 04-6)  this feature is documented 

line 647 
"MySQLManager" <- 
function(max.con=10, fetch.default.rec = 500, force.reload=F)

line 1400
"fetch.MySQLResultSet" <- 
function(res, n=0)   
## Fetch at most n records from the opened resultSet (n = -1 means
## all records, n=0 means extract as many as "default_fetch_rec",
## as defined by MySQLManager (see describe(mgr, T)).

regards,
	JN


%
%-- 
%Jay Pfaffman                           pfaffman at relaxpc.com
%+1-415-821-7507 (H)                    +1-415-810-2238 (M)
%
%-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
%r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
%Send "info", "help", or "[un]subscribe"
%(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
%_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
%

***********************************************************************
Jens Nieschulze

Institute for Forest Biometrics &	Phone: ++49-551-39-12107
Applied Computer Science		Fax  : ++49-551-39-3465
Buesgenweg 4
37077 Goettingen		E-mail: jniesch at uni-forst.gwdg.de
GERMANY				http://www.uni-forst.gwdg.de/~jniesch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,
Jay Pfaffman wrote:
Hmm, help(fetch) says
...
Usage:

     fetch(res, n, ...)

Arguments:

     res: a `resultSet' object. This object needs to be the result of a
          `SELECT' or `SELECT'-like statement, as produced by `dbExec.'
          or `dbExecStatement.' SQL statements such as `INSERT',
          `DELETE', do not create result sets. 

       n: maximum number of records to retrieve per fetch. Use `n = -1'
          to retrieve all pending records. Some implementations may
          recognize other special values (RS-MySQL interprets `n = 0'
          to mean "use whatever default was set in the call to
          `MySQL'). 

    ... : any other database-engine specific arguments. 

and if you follow the link to help(MySQL) ...

Usage:

     MySQL(max.con = 10, fetch.default.rec = 500, force.reload = F)

Arguments:

max.con : maximum number of connections that we intended to have open.
          This can be up to 100, a limit defined at compilation time.
          Strictly speaking this limit applies to MySQL servers, but
          clients can have (at least in theory) more than this. 

fetch.default.rec: number of records to fetch at one time from the
          database. (The `fetch' method uses this number as a default.) 

force.reload: should we reload (reinitialize) the client code? Setting
          this to `TRUE' allows you to change default settings.  Notice
          that all connections should be closed before re-loading. 


so I think it's clear (but I'm open to suggestions).

Regards,

  
    
#
Jens Nieschulze wrote:
but it is (for sure on 0.4-6).