beanumber / etl

R package to facilitate ETL operations
127 stars 21 forks source link

Cleanup dbGetQuery_safe #13

Closed beanumber closed 8 years ago

beanumber commented 8 years ago

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.

beanumber commented 8 years ago

This could be obviated by the mysqlExecQuery() function in the bleeding-edge version of RMySQL, but doesn't exist in other implementations.