Skip to content
Prev 28 / 1559 Next

Rdbi package plus draft proposal (was Re: Rdbi package)L

David James wrote:

            
I guess I'm becoming convinced. Actually, I put a driver class into Rdbi 
(based on your original proposal), but its only used to autoload the 
driver package and cause dispatch to the correct connection-generator. I 
think associating data conversion with driver objects, rather than the 
package itself, will be necessary when accessing, for example, different 
postgresql databases that have different sets of user-defined types. 
That would require a per-driver set of conversion routines.

My hesitancy is based on my assumption that 95% of users will access the 
same database every R session and will not enjoy having to reconstruct 
their environment from scratch each time. That's why I'm interested in 
persistent connections and so on. In fact, I'd like to find a clean way 
to have a default connection be used when no connection object is 
supplied to the query routines. Perhaps the best way to do this is to 
create another package that sits on top of the SDBI (or whatever we 
decide to call it) package and provides a seperate interface that 
internally hides the driver, connection and result objects.
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.)