Skip to content
Prev 1472 / 1559 Next

DBI preferred syntax

Hi Paul,

Here are my thoughts:

* dbDriver("SQLite") - never do this. dbDriver initialisation should
only ever be performed by the package (that's the whole point of
RSQLite::SQLite).

* dbConnect("SQLite", "test") - this used to work, but I think it's a
bad idea in general, because it interfaces poorly with namesspaces

* dbConnect(SQLite(), "test") - this will work but only if RSQLite is
attached (i.e. on the search path)

* 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").

* dbConnect(getExportedValue("RSQLite", "SQLite")()) - equivalent to
above, but use strings.


Hadley
On Sat, Oct 11, 2014 at 12:18 PM, Paul Gilbert <pgilbert902 at gmail.com> wrote: