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

make odbcDataType() respect integer64 #698

Merged
merged 4 commits into from
Dec 20, 2023
Merged

make odbcDataType() respect integer64 #698

merged 4 commits into from
Dec 20, 2023

Conversation

simonpcouch
Copy link
Collaborator

Closes #514.

@simonpcouch
Copy link
Collaborator Author

With this PR:

library(odbc)
library(DBI)
suppressPackageStartupMessages(library(bit64))
library(dbplyr)
odbc::odbcDataType(dbplyr::simulate_mssql(), bit64::as.integer64(1))
#> [1] "BIGINT"

Created on 2023-12-19 with reprex v2.0.2

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

My only worry with this change is that it's going to break use of integer64 with other backends because it will now hit the unsupported type clause. So I think you should update all the odbcDataType() methods to add integer64 to the switch, just using the same value as integer.

@@ -92,6 +92,9 @@ object_type <- function(obj) {
if (is(obj, "difftime")) {
return("time")
}
if (is(obj, "integer64")) {
Copy link
Member

Choose a reason for hiding this comment

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

These should all really use inherits(), so I added to #673

Since `switch_type()` now knows about integer64, we set the mappings for `int64` to whatever they used to map to in methods where we don't want behavior to change.
@simonpcouch
Copy link
Collaborator Author

Totally makes sense. 628879c.

NEWS.md Outdated
@@ -5,6 +5,8 @@

* Use correct parent class for Oracle (#685).

* The Microsoft SQL Server method for `odbcDataType()` will now return `"BIGINT"`
Copy link
Member

Choose a reason for hiding this comment

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

Conventionally we usually put new news bullets at the top. No need to change here, just remember in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Heard. Had to merge NEWS upstream anyway so just bumped that entry up.🐧

@hadley hadley merged commit 06a1f9b into main Dec 20, 2023
16 checks passed
@hadley hadley deleted the mssql-514 branch December 20, 2023 14:52
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.

odbcDataType converts integer64 to double
2 participants