Cannot get data and report an error:EOF v1.5.0
Closed this issue · 2 comments
samcoders commented
connect, err := sql.Open("clickhouse", fmt.Sprintf("http://%s/%s", "127.0.0.1:8123", "default"))
if err != nil {
fmt.Println(err.Error())
return
}
err = connect.Ping()
if err != nil {
fmt.Println(err.Error())
return
}
sols := fmt.Sprintf("select id,name from %s limit 10", TableName())
rows, err := connect.Query(sols)
if err != nil {
fmt.Println(err.Error())
return
}
//If the name value is empty, the Next() method directly skips the name value and the following data, and rows.Err()
//reports error: EOF
// version v1.5.0
for rows.Next() {
var (
id uint64
name string
)
err := rows.Scan(&id, &name)
if err != nil {
continue
}
fmt.Println(id, name)
}
if rows.Err() != nil {
fmt.Println(rows.Err().Error())
}
_ = rows.Close()
DoubleDi commented
Hi! Please share the full query so we can investigate
DoubleDi commented
Thanks, can you please also specify the table structure with the types