[R-sig-DB] DBI preferred syntax

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Sun Oct 12 21:18:26 CEST 2014


On Sun, Oct 12, 2014 at 9:59 AM, Hadley Wickham <h.wickham using gmail.com> wrote:
>>> * dbConnect(RSQLite::SQLite(), "test") - this is the best way in my
>>> opinion. It doesn't require that RSQLite be attached, just DBI, which
>>> I think is the right approach. A DBI backend (in general) should only
>>> ever provide methods, not new generics, so it shouldn't need to be
>>> attached. In other words, you should _never_ need require("RSQLite").
>>
>> I agree with that as a general guideline.
>>
>> It might be worth considering that some backends may implement backend specific functionality. While that brings it out of line of DBI, it always bums me out to not have a way to escape the lowest common denominator functionality.  So perhaps there are cases for directly requiring a backend?
>
> Right - you shouldn't have to require a backend, but you might want
> to. (Also I think it would be good for custom backend functions to be
> named like sqliteFunction rather than dbFunction, to make it more
> clear to the user that they're extensions)

But then if there is an extension that several databases support you
can't call them with common code with them but will be forced to
create yet another layer over them.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com




More information about the R-sig-DB mailing list