Closed
Description
mysql version: 5.7.10
mysql driver commit: 267b128
go version: 1.5.1 + 1.5.3
os: windows 8.1
package main
import(
"database/sql"
_ "github.com/go-sql-driver/mysql"
"fmt"
)
const(
sqlDriver = "mysql"
sqlConnectionString = "usr:pwd@tcp(localhost:3306)/my_test_db?parseTime=true&loc=UTC"
)
//This was run with go version 1.5.3, mysql 5.7.10 and go-sql-driver/mysql commit 267b128680c46286b9ca13475c3cca5de8f79bd7
func main(){
db, _ := sql.Open(sqlDriver, sqlConnectionString)
db.Exec(`
CREATE PROCEDURE test_proc()
BEGIN
SELECT TRUE;
SIGNAL SQLSTATE
'45001'
SET
MESSAGE_TEXT = "an error",
MYSQL_ERRNO = 45001;
END
`)
val := false
rows, err = db.Query("CALL test_proc()")
if err == nil {
fmt.Println("unexpected err is nil")
}
if rows == nil {
fmt.Println("unexpected rows is nil")
}
for rows.Next() {
if err = rows.Scan(&val); err != nil {
fmt.Println("unexpected err is not nil")
}
if val != true {
fmt.Println("unexpected val is not true")
}
fmt.Println("program will lock up on next entry to rows.Next()")
}
rows.Close()
fmt.Scanln()
}
This produces output:
unexpected err is nil
program will lock up on next entry to rows.Next()
before getting stuck in the locked state.