I recently updated my Go version to 1.16 and for all my queries I now get 
an error:

{"error":"Dynamic SQL Error\nSQL error code = -303\narithmetic exception, 
numeric overflow, or string truncation\nstring right truncation\n"}

I'm using  the package:   _ "github.com/nakagami/firebirdsql"

The following is a simple function:

func getSystem(w http.ResponseWriter, r *http.Request) {
type system struct {
Tax1    float64  `json:"tax1"`
Fees1  float64  `json:"fees1"`
Fees2   float64  `json:"fees2"`
Minus_stk string `json:"minus_stk"`
Discount1 float64 `json:"discount1"`
Discount2 float64 `json:"discount2"`
Discount3 float64 `json:"discount3"`
Discount4 float64 `json:"discount4"`
Elderly float64 `json:"elderly"`
Message NullString `json:"message"`
Binary4 NullString `json:"binary4"`
}
sysdata := []system{}
sql2 := "select tax1, fees1, fees2, minus_stk, discount1, discount2, 
discount3, discount4, elderly, cast(mesg as varchar(400)), binary4 from 
system"
    conn, _ := sql.Open("firebirdsql",  datapath)
    defer conn.Close()
rows, err := conn.Query(sql2)
if err != nil {
respondWithError(w, http.StatusBadRequest, err.Error())
return
}
defer rows.Close()
for rows.Next() {
var p system
err := rows.Scan(&p.Tax1, &p.Fees1, &p.Fees2, &p.Minus_stk, &p.Discount1, 
&p.Discount2, &p.Discount3, &p.Discount4, &p.Elderly, &p.Message, 
&p.Binary4)
if err != nil {
respondWithError(w, http.StatusBadRequest, err.Error())
return
}
sysdata = append(sysdata, p)
}
err = rows.Err()      //  <--- errors seem to thrown here.
if err != nil {
respondWithError(w, http.StatusBadRequest, err.Error())
return
}
respondWithJSON(w, http.StatusOK, sysdata)
}

Your help would be appreciated.

I'm using Firebird 2.5. Everything worked under the previous version of Go. 
I am scanning for null values so I don't believe that is the issue.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3594e3a5-b6e7-431c-8719-5f5dbdf9b933n%40googlegroups.com.

Reply via email to