Fix DBI incompatibility by implementing a method for DBI::dbSendStatement()
Summary
RJDBC has an incompatibility with the DBI generic interface, which can be fixed by implementing a method for DBI::dbSendStatement() that calls RJDBC::dbSendUpdate(). I think this is a one-line fix.
Details
Since RJDBC is the JDBC backend for DBI, many packages call RJDBC through DBI generics. For example, dbplyr::compute(), which is designed to create tables, uses DBI::dbExecute() to send the table creation DML to the appropriate method. If a JDBC connection is used, it will ultimately ask RJDBC to execute the DML, as explained in this issue.
For data manipulation queries like creating tables, DBI::dbExecute() calls the generic DBI::dbSendStatement(). The DBI authors ask that database package developers include a method for this generic. If one doesn't exist, the default is to forward to dbSendQuery():
dbSendStatement() comes with a default implementation that simply forwards to dbSendQuery(), to support backends that only implement the latter.
The problem is that RJDBC::dbSendQuery() is not the right RJDBC method for creating tables. Per the documentation, RJDBC::dbSendUpdate() is the right method:
dbSendQuery and dbSendUpdate submit a SQL query to the database. The difference between the two is only that dbSendUpdate is used with DBML queries and thus doesn't return any result set.
If RJDBC implements a method for DBI::dbSendStatement() that calls RJDBC::dbSendUpdate(), then functions like dbplyr::compute() will work as intended instead of throwing an error.