[R-sig-DB] dbDriver("name")

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Tue Oct 22 15:15:16 CEST 2013


>> For your code, you could do
>> something like:
>>
>> find_driver <- function(name) {
>>    getExportedValue(paste0("R", name), name)()
>> }
>>
>> setMethod("TSconnect",   signature(drv="character", dbname="character"),
>>     definition=function(drv, dbname, ...)
>>               TSconnect(find_driver(drv), dbname=dbname, ...))
>>
>> It may be worthwhile to include find_driver in DBI.
>
>
> Thanks for the suggestion, however, I remain a bit confused. The function
> find_driver() seems like a direct replacement for dbConnect(), using a
> string to identify the database driver. You would be supporting what is a
> bad idea, and just changing the name of the function, which is a make work
> project for everyone.

So unless we want to invent a completely new way of registering
drivers, it seems like patching dbDriver to use this strategy will be
effective. However, I think we should equally encourage people to use
the driver object directly, instead of the string. That doesn't help
you, but it does help people only concerned with connecting to one
database.

Hadley

-- 
Chief Scientist, RStudio
http://had.co.nz/




More information about the R-sig-DB mailing list