-
Notifications
You must be signed in to change notification settings - Fork 1k
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
#BUG: sql.Execute get rows count will panic nil error #964
Comments
Is this with What version? Could you give a full example that I can run to reproduce this? Is there a stack ? |
first |
I can reproduce this with this code: package main
import (
"fmt"
"github.com/go-mysql-org/go-mysql/client"
_ "github.com/go-mysql-org/go-mysql/client"
)
func main() {
fd, err := client.Connect("127.0.0.1:3306", "root", "", "test")
if err != nil {
panic(err)
}
fmt.Printf("fd = %#v\n", fd)
fd.Execute(`drop table if exists t`)
fd.Execute(`create table t(x int, y int, z int, primary key (x,y,z))`)
result, err := fd.Execute(`insert into t(x,y,z) values(1,2,3)`)
if err != nil {
panic(err)
}
fmt.Printf("result = %#v\n", result)
rows := result.RowNumber()
fmt.Printf("rows = %#v\n", rows)
columns := result.ColumnNumber()
fmt.Printf("columns = %#v\n", columns)
} Result:
This is on Linux with MySQL 9.1.0 |
The problem here is that
|
Yes, I use a more violent approach here to directly judge ...
if r == nil {
return 0
}
... |
@dveeden It's the same |
However, this situation is not intuitive. In fact, unless it is manually cleared, it will not be empty. There may be a deeper bug. |
@DoMySon Can you provide a full runnable, reproduce code for us? Or answer my questions to explain what's happened in your example?
|
Oh I see your screenshot. -- update -- The root cause is we always return a not-nil All exported methods on |
The text was updated successfully, but these errors were encountered: