-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
defer getWarnings() after fetching resultsets. #605
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.
This never actually checks if strict mode is active
driver.go
Outdated
@@ -175,6 +175,10 @@ func handleAuthResult(mc *mysqlConn, oldCipher []byte) error { | |||
} | |||
_, err = mc.readResultOK() | |||
} | |||
|
|||
if err == nil && mc.warningCount > 0 { |
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.
this doesn't check if the strict mode is active
infile.go
Outdated
@@ -175,6 +175,9 @@ func (mc *mysqlConn) handleInFileRequest(name string) (err error) { | |||
// read OK packet | |||
if err == nil { | |||
_, err = mc.readResultOK() | |||
if err == nil && mc.warningCount > 0 { |
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.
same here
We already know that the strict mode might lead to data corruption and this PR seems to make it even worse. How about we eventually completely remove the strict mode instead? |
I haven't used use strict mode in Go. I want to keep some way to check warning count and "SHOW WARNINGS". |
How is the Python driver showing warnings by default? Does it send a |
Like this pull request. |
67c0581
to
7a1a598
Compare
hmm, why travis doesn't work? |
I think Travis had some issues in the last few days. I restarted the job for this PR. Let's see if it works. |
nope, that didn't work. Maybe add another commit (or amend and force-push the previous one) to trigger another build? |
@@ -31,6 +31,7 @@ type mysqlConn struct { | |||
sequence uint8 | |||
parseTime bool | |||
strict bool | |||
warningCount uint16 |
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 fields are sorted by size for efficient struct packing. The warningCount
field should moved up (before flags
I think)
Description
Don't query "SHOW WARNINGS" in
handleOkPacket()
. Defer it to end of query.fixes #602, maybe.
Checklist