[R-sig-DB] RSQLite "close resultSet before continuing" error in dbBeginTransaction()

Andrew Piskorski @tp @end|ng |rom p|@kor@k|@com
Fri Aug 19 11:19:33 CEST 2011


Hello, I recently started using RSQLite, version 0.9-4 (2010-11-24),
with R version 2.12.2 Patched (2011-03-18 r55969), on x86-64.

While running background jobs which insert rows into my SQLite table,
dbBeginTransaction() sometimes throws this error (see also the stack
trace further below):

  connection with pending rows, close resultSet before continuing 

The frustrating thing is that AFAICT I am not using any RSQLite
functions which return a resultSet!  Also, I have not been able to
replicate this error interactively, so I'm reduced to guessing what
might be triggering it.

The only RSQLite functions I ever use anywhere in my code are:
dbConnect, dbDisconnect, dbGetException, dbListTables, dbGetQuery,
dbGetPreparedQuery, dbBeginTransaction, dbCommit, and dbRollback .

AFAICT none of those functions ever return a resultSet to the user,
although some of them probably do manipulate result sets in their
internal implementations.

Can anyone suggest what the true cause of this problem might be and
how I could better debug it?

Also, what's the best way to insure that my code doesn't die in
dbBeginTransaction() with this error?  So far I've added this
immediately before my dbBeginTransaction() call (cargo-culted from
what sqliteTransactionStatement does):

   ll <- dbListResults(handle)
   if (length(ll) > 0) {
      res <- ll[[1]]
      if (!dbHasCompleted(res)) dbClearResult(res)
   } 

But would it be better to instead, say, call dbDisconnect() and
dbConnect() every time before I start a new transaction?  Or some
other workaround?

Thanks for your help!

------------------------------------------------------------

Error in sqliteTransactionStatement(conn, "BEGIN") :  
  connection with pending rows, close resultSet before continuing 
Calls: do.call ... .valueClassTest -> is -> is -> sqliteTransactionStatement 
Error in sqliteTransactionStatement(conn, "BEGIN") :  
  connection with pending rows, close resultSet before continuing 
Calls: do.call ... .valueClassTest -> is -> is -> sqliteTransactionStatement 
 
#13: function () { dump.frames() traceback.stderr() q("no", status = 1, runLast = FALSE)  }() from 0 
#12: stop("connection with pending rows, close resultSet before continuing") from 11 
#11: sqliteTransactionStatement(conn, "BEGIN") from 10 
#10: is(object, Cl) from 8 
#9: is(object, Cl) from 8 
#8: .valueClassTest(standardGeneric("dbBeginTransaction"), "logical",  structure("dbBeginTransaction", package = "RSQLite")) from 7 
#7: dbBeginTransaction(handle) from 6 

-- 
Andrew Piskorski <atp using piskorski.com>
http://www.piskorski.com/




More information about the R-sig-DB mailing list