We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When run query shoud return values as "", "123", but instead return "", "".
"", "123"
"", ""
package main import ( "database/sql" "fmt" _ "github.com/go-sql-driver/mysql" "log" "os" ) type ResultStruct struct { field1 string `db:"field1"` field2 string `db:"field2"` } func main() { db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", os.Getenv("USER"), os.Getenv("PASS"), os.Getenv("ENDPOINT"), os.Getenv("PORT"), os.Getenv("DBNAME"))) if err = db.Ping(); err != nil { log.Fatal("Error : " + err.Error()) } defer db.Close() params := "123,456,789,121" query := fmt.Sprintf(`select field1, field2 from test_table where field1 in (%s) or field2 in (%s)`, params, params) rows, selectErr := db.Query(query) if selectErr != nil { log.Fatal("Error : " + selectErr.Error()) } for rows.Next() { var rs ResultStruct err := rows.Scan(&rs.field1, &rs.field2) if err != nil { log.Fatal("Error : " + err.Error()) } log.Printf("field1: %v | field2: %v", rs.field1, rs.field2) } }
Error : sql: Scan error on column index 0, name "field1": unsupported Scan, storing driver.Value type <nil> into type *string
Driver version (or git SHA): Implements a Travis CI task (#1070) git: 681ffa8
681ffa8
Go version: 1.12.7
Server version: MySQL 5.6.48
Server OS: Manjaro Linux 18.0.4
The text was updated successfully, but these errors were encountered:
It is not "reproducible example". Please provide schema and dataset too.
Sorry, something went wrong.
Does rows.Scan return an error?
That isn't a bug, that's a misunderstanding.
sql.NullString help avoid that problem.
However follows a database dump: https://shrib.com/#database_dump
Thanks guy!
Can close this issue? Your have any more question?
No branches or pull requests
Issue description
When run query shoud return values as
"", "123"
, but instead return"", ""
.Example code
Error log
Configuration
Driver version (or git SHA): Implements a Travis CI task (#1070) git:
681ffa8
Go version: 1.12.7
Server version: MySQL 5.6.48
Server OS: Manjaro Linux 18.0.4
The text was updated successfully, but these errors were encountered: