When the query works with other DBs & their Go  drivers this strongly
suggest that there is some incompatibility of the Firebird vs. Go 16.x.

Thus you should check the suggestion from Jake to update the Firebird
driver for Go.

In the Github project
https://github.com/nakagami/firebirdsql/commits/master
<https://github.com/nakagami/firebirdsql/commits/master>

In Commits on Jun 21, 2021 used go version in go.mod was change to 1.15 and
the readme file now startes that go 1.15 or newer is supported. May be this
helps.

BR,
Roland

Am Sa., 26. Juni 2021 um 19:03 Uhr schrieb Hugh Myrie <hugh.my...@gmail.com
>:

> That is a possibility. I didn't try to rebuild under Go1.14., but I will
> give that a try.  Interestingly, one "select query" worked but the others
> failed with similar error messages. After upgrading to G1.16 I ran "go
> tidy" which downloaded the libraries and create a "mod" file in the working
> folder, so I take it that the libraries are correct. I'll try your
> suggestion and let you know.
>
>   I am able to access and read MySQL and MariaDB tables with the updated
> Go version.
>
> On Saturday, June 26, 2021 at 10:43:15 AM UTC-5 jake...@gmail.com wrote:
>
>> Is it possible that the version of the library you are using also changed
>> when you changed versions of Go?
>> Have you tried building again, on the same machine, using Go 1.14 to make
>> sure that the only difference is the Go language version?
>>
>> On Thursday, June 24, 2021 at 11:14:30 AM UTC-4 hugh....@gmail.com wrote:
>>
>>> 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/90a32eff-32c0-4d6d-a822-e843bbc5b31an%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/90a32eff-32c0-4d6d-a822-e843bbc5b31an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CA%2B8p0G2tm0x9GxKUuy95JGS8HZQOqR3K3qmxwZ8Hxty0m-F9VA%40mail.gmail.com.

Reply via email to