[R-sig-DB] default driver and connection

Gabor Grothendieck ggrothend|eck @end|ng |rom gm@||@com
Thu Jul 19 19:51:54 CEST 2007


On 7/19/07, Seth Falcon <sfalcon using fhcrc.org> wrote:
> "Gabor Grothendieck" <ggrothendieck using gmail.com> writes:
> > Now perhaps its enough to check for specific load packages and it is
> > convenient. On the other hand it would be even more convincing that the
> > user wanted to use a particular database it they had actually loaded the
> > driver for it regardless of which library calls had been made -- although
> > admittedly the user would then have to issue another statement, the
> > dbDriver statement, so its slightly less convenient than what we
> > have above.
>
> How about a function in your package that sets the default db driver:
>
>   setDefaultDb("MySQL")
>
> This function could set a value in an environment object in your
> package's namespace.  Users could load your package and call this
> function in their .Rprofile for added convenience.  IMO relying on
> packages being loaded (or not) is fragile.

I agree that querying packages for being loaded is fragile. That is
why I originally had the question of how to query whether the database
driver was loaded.  I thought that would be more reliable than relying
on package loading since one is not likely to load a database
driver they don't intend to use.

The problem with setDefaultDb is that it adds duplicate infrastructure.
Its just something else to learn, document, use, etc. whereas the
dbDriver infrastructure already exists and I think it would be better to
be able to leverage off that.

I guess one possibility would be to have a dbDriver option and my
program could use getOptions to retrieve it, defaulting to
SQLite if the option were missing; however, even that
adds a new option that was not there before and is, in principle,
unnecessary if one could discover what drivers were loaded.




More information about the R-sig-DB mailing list