[R-sig-DB] Add a "dbSendUpdate" function to DBI?

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Thu Sep 4 21:15:13 CEST 2014


> It is the "If the API" part that I worry about. For example
>
>> success(warning("warn"))
> Warning message:
> In doTryCatch(return(expr), name, parentenv, handler) : warn
>> is.logical(success(warning("warn")))
> [1] FALSE
> Warning message:
> In doTryCatch(return(expr), name, parentenv, handler) : warn
>>
>
> So then every package writer trying to build on DBI has to write a wrapper
> that anticipates the exceptions that may be thrown. This becomes even more
> difficult when different db drivers, different OSes, and different servers
> are involved.

I'm not sure I follow, because we hadn't talked about warnings. I
would not expect that DBI backends to through warnings instead of
errors.

> Given the philosophical constraint I think I would generally prefer the
> function that is guaranteed to return a logical. The other wrapper is easy
> to write too.

But it's fundamentally more dangerous. If all modification functions
return TRUE or FALSE and you don't explicit check the return value, it
is extremely easy to create invalid code. The same is not true for
errors.

Hadley


-- 
http://had.co.nz/




More information about the R-sig-DB mailing list