-
Notifications
You must be signed in to change notification settings - Fork 178
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
Add escapes for dates and datetimes for MS Access #609
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a bullet to the top of NEWS.md
? It should briefly describe the change and end with (@yourname, #issuenumber)
.
R/backend-access.R
Outdated
sql_escape_datetime.ACCESS <- function(con, x) { | ||
# Access delimits datetimes using octothorpes, and uses YYYY-MM-DD HH:MM:SS | ||
# Timezones are not supported in Access | ||
y <- format(x, "#%F %T#") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does not supporting time zones imply here? Should we always generate a time in the system time zone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means timezone information is ignored when you escape a value that includes timezone information, e.g. escape(as.POSIXct('2020-01-01 01:01:01', tz = "US/Alaska"), con = simulate_access())
will result in the same thing as escape(as.POSIXct('2020-01-01 01:01:01', tz = "Europe/Berlin"), con = simulate_access())
.
Some RDBMSes have a concept of timezones (e.g. SQL Server, Oracle) and when escaping a datetime field the timezone could be included, however, Access does not.
I assume that's a non-issue, especially since escapes for those databases (e.g. escape(as.POSIXct('2020-01-01 01:01:01', tz = 'US/Alaska'), con = simulate_mssql())
) always provides the zulu timezone and also ignore timezone information. But that's a separate issue, and one that's considerably harder to address and might break existing code when addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it. Thanks for the explanation!
Per preference of Hadley Wickham, adjusted the format strings to more explicitly write out the format
Closes #608