the result format of binary protocol is different from text protocol
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
package main
import (
"context"
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
var (
dsn ="root:@tcp(172.16.4.181:17000)/test?"
)
func mustExec(c *sql.Conn, query string) {
_, err := c.ExecContext(context.Background(), query)
if err != nil {
panic(err)
}
}
func main() {
db, err := sql.Open("mysql", dsn)
if err != nil {
panic(err)
}
defer db.Close()
c, err := db.Conn(context.Background())
if err != nil {
panic(err)
}
defer c.Close()
mustExec(c, "drop table if exists t")
mustExec(c, `create table t(a enum("one"), col2 double, col3 year);`)
mustExec(c, "insert into t values(\"one\", -1.3423674863023717e+308, 2030);")
stmt, err := db.Prepare("select * from t where a = ?")
if err != nil {
panic(err)
}
ss := [][]interface{}{[]interface{}{"one"}}
for _, v := range ss {
rows, err := stmt.Query(v...)
if err != nil {
panic(err)
}
fmt.Println(rows.Columns())
for rows.Next() {
var str1 string
var str2, str3 string
rows.Scan(&str1, &str2, &str3)
fmt.Printf("%s %s %s\n", str1, str2, str3)
}
rows.Close()
}
mustExec(c, "prepare stmt from 'select * from t where a =?'")
mustExec(c, "set @a='one'")
rows, err := c.QueryContext(context.Background(), "execute stmt using @a")
if err != nil {
panic(err)
}
for rows.Next() {
var str1 string
var str2, str3 string
rows.Scan(&str1, &str2, &str3)
fmt.Printf("%s %s %s\n", str1, str2, str3)
}
rows.Close()
}
```
### 2. What did you expect to see? (Required)
```
one -1.3423674863023717e+308 2030
one -1.3423674863023717e+308 2030
```
### 3. What did you see instead (Required)
```
one -1.3423674863023717e+308 2030
one -1.3423674863023717e308 2030
```
### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.