[R] RMySQL fetch defaults to N=500?

David James dj at research.bell-labs.com
Fri Aug 9 13:59:33 CEST 2002


Hi,

Jay Pfaffman wrote:
> 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.

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,

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

-- 
David A. James
Statistics Research, Room 2C-253            Phone:  (908) 582-3082       
Bell Labs, Lucent Technologies              Fax:    (908) 582-3340
Murray Hill, NJ 09794-0636
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list