-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix TIME value sign byte #140
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
Conversation
using an empty string ("") instead of the 0 byte []byte('0') when formatting positive TIME fields.
Thanks for the PR. |
I mean a test in driver_test.go 😉 |
Of course Julien :-), I've added a test and ran it against the
Damn invisible chars! The same test succeeds with the proposed fix:
|
I'm still curious why this happens only when using "?" arguments in queries. |
First off: Thank you for the Pull Request! The bug only happens when you use "?" because that (or prepared statements) trigger the binary protocol, otherwise the text protocol is used. In the text protocol, the TIME fields are sent and returned as strings. See readRow in packets.go. LGTM 👍 |
@@ -514,6 +514,45 @@ func TestDateTime(t *testing.T) { | |||
} | |||
} | |||
|
|||
// This tests for https://github.com/go-sql-driver/mysql/pull/140 |
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.
The bug report was #139
140 is the fix ;)
for _, sTime := range sTimes { | ||
dbt.db.Exec("DROP TABLE IF EXISTS test") | ||
dbt.mustExec("CREATE TABLE test (id INT, time_field " + sTime.fieldType + ")") | ||
dbt.mustExec("TRUNCATE TABLE test") |
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.
A new table is always empty 😉
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.
Duh! yeah. Initially the CREATE
statement was outside the loop and it made sense once, however it is of no use anymore.
…and fixing the reference URL.
LGTM |
Fix TIME value sign byte
Forgot to add him in #140
Attempts to fix #139