forked from go-sql-driver/mysql
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Multi Results support and discard additional results
- packets.go: flag clientMultiResults, update status when receiving an EOF packet, discard additional results on readRow when EOF is reached - statement.go: currently a nil rows.mc is used as an eof, don’t set it if there are no columns to avoid that Next() waits indefinitely - rows.go: discard additional results on close and avoid panic on Columns()
- Loading branch information
Showing
3 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9542bdd
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 is exactly the correction this driver needs. This solution enables use of stored procedures without compromising the integrity of the go-sql-driver/mysql package. Yes, there is a place for stored procedures in modern code. They allow for essential database performance enhancements and eliminate the need for ugly string pasting to make sql queries in go code.
I have been writing software for 35 years and see this solution as absolutely essential to maturing and completing this driver. So when will this be unified into the main thread? Do you need help making the case for unifying this fork?
9542bdd
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.
@Idhor My testing indicates that func statement.Exec() needs to capture the insertid when a stored procedure performs an insert. Currently, insertid comes back as 0 with err=nil
9542bdd
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.
Unfortunately i'm not using it in production yet so i'm doing those changes just when i discover that i need them
To be able to propose a pull request some tests should be written but i don't have much time so if someone writes them and does the pull request by copying my code i will not be angry ^^
Furthermore this change discards all additional results so it doesn't need non-standard driver methods
See go-sql-driver#66 (comment)
9542bdd
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.
Hi,
I'd like to use this commit in the main repository. Can you please make an entry into the AUTHORS file for copyright purposes?
Thank you!
9542bdd
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.