Implementation of RMySQL
Jeffrey Horner wrote:
I noticed that this package stores pointers to MySQL related data structures i R objects as an integer vector of up to length 3: (from RMySQL/src/RS-DBI.h): /* In R/S a dbObject is a foreign reference consisting of a vector * of 1, 2 or 3 integers. In the C implementation we use these * R/S vectors as handles (we could have use pointers). */ Why were they not stored in the R object using the R External Pointer interface, described here: http://www.stat.uiowa.edu/~luke/R/references/weakfinex.html On a related note, the connection is not closed when assigning NULL to the connection object. This could be accomplished by using the Finalization Interface described in the above reference... Any reason this was not used? Also, in light of a recent discussion on the R-devel mailing list(see S3/S4 classes performance comparison), does the S4 implemented DBI package hinder performance in any way for the RMySQL package? -- Jeffrey Horner Computer Systems Analyst School of Medicine 615-322-8606 Department of Biostatistics Vanderbilt University
The original implementation predates external pointers/weak references. Moreover, at that time I decided to make the package (plus ROracle and RSQLite) compatible with S-Plus both at the S level and the C underlying code (this is a decision I now regret). I expect to change the implementation, time permitting, in a future version. Re: S4 performance, I haven't noticed any disadvantages, perhaps because the delays due to running SQL queries on remote severs and/or data transmissions tend to be much larger than S4 object creation. I do feel that the S4 classes and methods provide a better mechanism than S3 instance-based methods for this type of packages. Regards, -- David