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

dbQuoteLiteral with MySQL 8.0 #352

Open
jjaeschke opened this issue Nov 18, 2024 · 3 comments
Open

dbQuoteLiteral with MySQL 8.0 #352

jjaeschke opened this issue Nov 18, 2024 · 3 comments

Comments

@jjaeschke
Copy link
Contributor

DBI Version 1.2.3 changed the format returned by dbQuoteLiteral() for POSIXct values from %Y%m%d%H%M%S to %Y-%m-%d %H-%M-%S%z. This breaks support for MySQL 8.0, as the string is no longer recognized as a valid DATETIME string due to the added timezone info.

It might be an issue with MySQL 8 or MySQL in general, but since I don't have a server of those other versions to check against, I can't tell for certain.

Since this seems to be an issue specific to MySQL 8.0, I'm filing it here, rather than with the DBI package itself. If this is wrong, please advise and I'll file it there, instead.

@krlmlr
Copy link
Member

krlmlr commented Nov 19, 2024

Thanks, that's too bad.

There's a new-ish mysql = NULL argument to our dbConnect() . Can we leverage that to quote literals differently depending on the database we connect to?

@jjaeschke
Copy link
Contributor Author

dbConnect() does return an object of the class MySQLConnection if mysql is TRUE.

Maybe we could create a method for dbQuoteLiteral() for that class that overrides the behavior for quoting Datetime objects and refers to the more generic method for everything else?

@jjaeschke
Copy link
Contributor Author

I've tried implementing this in a barebones PR. Let me know if this needs some more work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants