RSQLite problems / questions
On Fri, Jul 07, 2006 at 08:29:08AM +0100, Prof Brian Ripley wrote:
On Fri, 7 Jul 2006, Prof Brian Ripley wrote:
On Thu, 6 Jul 2006, Dirk Eddelbuettel wrote:
[..]
Same 46 limit of 46 connections I hit earlier. This seems to be a bug in SQLite or DBI.
The message is that R is hitting its limit (50, including 3 terminal connections), so the problem is in DBI.
Actually, in package RMySQL, which has in mysqlImportFile()
if(missing(header) || missing(row.names)){
f <- file(fn, open="r")
if(skip>0)
readLines(f, n=skip)
flds <- count.fields(textConnection(readLines(f, n=2)), sep)
close(f)
nf <- length(unique(flds))
}
and that never closes the connection it created. This needs to be
something like
con <- textConnection(readLines(f, n=2))
flds <- count.fields(con, sep)
close(con)
or perhaps better, use an on.exit action to close the connection.
Spot on -- thanks for finding this so quickly. RSQLite has an identical segment in the sibbling function sqliteImportfile(), and I applied the patch (with substitution of txtcon for con as a variable con is already in use). in So I suppose this takes care of one of my three questions, and would require new uploads of RMySQL, RSQLite, ... to CRAN once David resurfaces. Thanks, Dirk
Hell, there are no rules here - we're trying to accomplish something.
-- Thomas A. Edison