-
Notifications
You must be signed in to change notification settings - Fork 18k
database/sql: Improper error handling. #29975
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
Comments
Can you explain why it is necessary to check CC @kardianos |
For more information read documentation for type RowsNextResultSet interface and it is clearly mentioned that NextResultSet should return io.EOF when there are no more result sets. |
Please look at https://bitbucket.org/kardianos/table for the proper way to use NextResultSet. I'm aware of how to use it and the documentation; I wrote it. |
@kardianos, let me clear, i am new to database. The reason behind escalating this issue is that i want to know in which case NextResultSet return true? I tried all the cases using mysql database it is always returning false. If so then what is the use case of implementing NextResultSet? Before giving your answer, i would suggest you to do sample program on NextResultSet where it can return true case. I hope you got my Question. |
If you are new to databases and want some clarifications, please take a look at the Questions wiki page to ask questions like these. You will get better and faster answers there. The issue tracker is primarily for bugs and proposals. |
@agnivade, I understand your concern. I tried all the cases using mysql database, NextResultSet is always returning false. If so then it is bug right. So i am in right page for escalating this as an issue. |
Its was my big mistake. There is NO issue in NextResultSet method. I was working with different databases using golang sql package. I was thinking this same behavior with MySQL using (github.com/go-sql-driver/mysql) Eventually i found unexpected behavior (or bug) of lib/pq I filed an issue report on lib/pq. |
#29973
go/src/database/sql/sql.go
Line 2729 in 66065c3
I think it would be better to refactor error handling code something like this:
if err := rs.lasterr; err != nil && err != io.EOF {
The text was updated successfully, but these errors were encountered: