odbc icon indicating copy to clipboard operation
odbc copied to clipboard

OdbcResult: Ability to explicitely describe parameters

Open detule opened this issue 11 months ago • 0 comments

Hi @simonpcouch @hadley

This is a draft/RFC of a feature that would allow (power) users to explicitly describe parameter attributes when submitting parametrized queries.

The details are in https://github.com/r-dbi/odbc/issues/518 and this PR would address the issue there. In summary:

  • We do a very good job of inferring the parameter metadata, but at the end of the day it's only an informed guess.
  • In some cases the user may wish to override those inferred values. Linked issue above is one of those.
  • Offer them the ability to do that. This type of feature is not uncommon in other ODBC programming interfaces.

Some notes about the PR:

  • Added an ODBC_TYPE helper method that would help with the user not having to guess what integer corresponds to SQL_WVARCHAR, for example.
  • The example is in ?OdbcResult.
  • I have a few items below as TODOs, including offering the usage of this parameter more broadly.

TODO:

  • [ ] Rename ODBC_TYPE to SQL_TYPE
  • [ ] Permeate parameter_description to dbSendQuery, dbGetQuery
  • [ ] Add unit tests

detule avatar Nov 30 '24 00:11 detule