The issue is that dbGetQuery() has to return a data frame. But if you want to run a query like DROP TABLE there is no resulting data frame, so you get an error. But if you use dbSendQuery() instead, you won't get a result set even if you want one.
So dbGetQuery_safe() works just like dbGetQuery(), but if you run a command with no result, it returns NULL.
The output could be cleaned up.
The issue is that
dbGetQuery()
has to return a data frame. But if you want to run a query likeDROP TABLE
there is no resulting data frame, so you get an error. But if you usedbSendQuery()
instead, you won't get a result set even if you want one. SodbGetQuery_safe()
works just likedbGetQuery()
, but if you run a command with no result, it returns NULL. The output could be cleaned up.