[R-sig-DB] Rdbi package plus draft proposal (was Re: Rdbi package)L

Timothy H. Keitt tk||@t@ddr @end|ng |rom ke|tt|@b@b|o@@uny@b@edu
Wed Oct 10 20:21:58 CEST 2001


Luke Tierney wrote:

>On Wed, Oct 10, 2001 at 01:44:50PM -0400, Timothy H. Keitt wrote:
>
>>>They would be similar to the current  showConnections/getConnection.
>>>
>>Actually, these might be useful for implementing the simplified 
>>interface described above. But does this mean we will have to explicitly 
>>destroy all connection and result objects? I think any objects generated 
>>should be garbage collected like any other R object; otherwise you are 
>>introducing a new object model. (I suppose connections could unregister 
>>themselves from the driver when garbage collected.)
>>
>
>Allowing DBconnections to be handled by the GC as a backup is I think
>the right thing to do.  Since they involve scarce resource, explicit
>closing should be encouraged.  The fact that the connection system
>does not do this is I think unfortunate and something I think we will
>have to revisit before too long (aside from the potential of leaving
>connections open it is too easy for one function's use of connections
>to trample anothers, especially if we go to any form of threading).
>
>It is nevertheless possible to allow a list of open connections to be
>obtained by using a weak reference mechanism. There is experimental
>support for this in the devel version, with some notes on it at
>http://www.stat.umn.edu/~luke/R/references/weakfinex.html (also off
>the developer page).
>
>luke
>
The finalizer hooks described in those notes are the ones I used in Rdbi 
to let the garbage collector close connections associated with a 
connection object that gets collected. I see that we could also use this 
to list open connections as well.

Tim

-- 
Timothy H. Keitt
Department of Ecology and Evolution
State University of New York at Stony Brook
Stony Brook, New York 11794 USA
Phone: 631-632-1101, FAX: 631-632-7626
http://life.bio.sunysb.edu/ee/keitt/






More information about the R-sig-DB mailing list