Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbConnect: clean up argument checks #851

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

detule
Copy link
Collaborator

@detule detule commented Sep 29, 2024

Closes #848

  • See issue for examples of how NULLs for specific arguments in dbConnect are handled prior to this patch.
  • With this patch:
┃  > dbConnect(odbc::odbc(), dsn = "mssql_oem_db", encoding = NULL )
┃                                                  Error in `.local()`:
┃  ! `encoding` must be a single string, not `NULL`.
┃  Run `rlang::last_trace()` to see where the error occurred.
┃  > dbConnect(odbc::odbc(), dsn = "mssql_oem_db", timezone = NULL )
┃                                                  Error in `.local()`:
┃  ! `timezone` must be a single string, not `NULL`.
┃  Run `rlang::last_trace()` to see where the error occurred.
┃  > dbConnect(odbc::odbc(), dsn = "mssql_oem_db", timezone_out = NULL )
┃                                                  Error in `.local()`:
┃  ! `timezone_out` must be a single string, not `NULL`.
┃  Run `rlang::last_trace()` to see where the error occurred.
┃  > dbConnect(odbc::odbc(), dsn = "mssql_oem_db", timeout = NULL )
┃                                                  Error in `.local()`:
┃  ! `timeout` must be a number, not `NULL`.
┃  Run `rlang::last_trace()` to see where the error occurred.

Also disallowed NA for timeout, as it's not clear from the documentation how that would be handled ( we allow Inf to mean "no timeout". IMO that's intuitive enough. ) Also documented the usage of NA for the timeout argument. No change in prior behavior.

Thanks!

Copy link
Collaborator

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

R/dbi-driver.R Outdated Show resolved Hide resolved
detule and others added 2 commits September 30, 2024 19:48
@detule detule merged commit d4d5ee5 into r-dbi:main Sep 30, 2024
14 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore: clean up check_* in dbi-driver
3 participants