Can you make that into a standalone program, which doesn't use a HTTP 
exchange but just does the query and exits?  If the problem is still there, 
then you have a very nice test case to submit upstream (along with details 
of exactly what version of firebird you're using, what platform you're 
running on etc)

If the problem goes away, but comes back when it's run as a HTTP server, 
then make a standalone program that contains a HTTP server and also 
demonstrates the problem.  What you've shown so far is just a snippet which 
isn't runnable as-is.

On Monday, 28 June 2021 at 12:48:23 UTC+1 hugh....@gmail.com wrote:

> Update: 
>
> I created a* new* database with only one table with two fields. Added 
> three records. I have also created a stripped down version of the Go 
> program with a function that query the table. The problem persist.
>
>
> *Table:*
>  CREATE TABLE TESTR
> (
>   CODE Varchar(5) NOT NULL,
>   DESCRIPTION Varchar(30) NOT NULL
> );
>
> *The Data.*
>
> insert into testr (code, description) values ('123', 'Data 1');
> insert into testr (code, description) values ('163', 'Data 5');
> insert into testr (code, description) values ('653', 'Data 2');
>
> *The Go function:*
>
> func getTest(w http.ResponseWriter, r *http.Request) {
>
> type test struct {
> Code  string  `json:"code"`
> Description   string  `json:"description"`
> }
> tests := []test{}
>
>
> conn, _ := sql.Open("firebirdsql", datapath)
>     defer conn.Close()
> rows, err := conn.Query("select code, description from testr")
> if err != nil {
> respondWithError(w, http.StatusBadRequest, err.Error())
> logError(err.Error())
> return
> }
>
> defer rows.Close()
> for rows.Next() {
> var t test
> err := rows.Scan(&t.Code, &t.Description)
> if err != nil {
> respondWithError(w, http.StatusBadRequest, err.Error())
> logError(err.Error())
> return
> }
> tests = append(tests, t)
> }
> err = rows.Err()
> if err != nil {
> respondWithError(w, http.StatusBadRequest, err.Error())
> logError(err.Error())
> return
> }
> respondWithJSON(w, http.StatusOK, tests)
>
> }
>
> *The call (from the browser):*
>
> 192.168.0.13:8080/test
>
> *The Error*:
>
> {"error":"Dynamic SQL Error\nSQL error code = -303\narithmetic exception, 
> numeric overflow, or string truncation\nstring right truncation\nexpected 
> length 1, actual 5\n"}
>
>
> On Monday, June 28, 2021 at 2:08:55 AM UTC-5 Brian Candler wrote:
>
>> Then it sounds to me like the problem is with your application, and/or 
>> with the data in your database, and that the problem has always been there.
>>
>> The error talks about "string right truncation". My suggestion would be 
>> to take your SQL query and start removing some fields from it, starting 
>> with the "message" and "binary4" fields.  In particular, is it possible 
>> that some value in your "mesg" column has more than 400 characters?
>>
>> sql2 := "select tax1, fees1, fees2, minus_stk, discount1, discount2, 
>> discount3, discount4, elderly, cast(mesg as varchar(400)), binary4 from 
>> 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)
>>
>> -->
>>
>> sql2 := "select tax1, fees1, fees2, minus_stk, discount1, discount2, 
>> discount3, discount4, elderly from system"
>> ...
>> err := rows.Scan(&p.Tax1, &p.Fees1, &p.Fees2, &p.Minus_stk, &p.Discount1, 
>> &p.Discount2, &p.Discount3, &p.Discount4, &p.Elderly)
>>
>> (Aside: those values have type "NullString" but your code snippet didn't 
>> show how that type was defined)
>>
>> If that doesn't make a difference, start chopping out the other fields.
>>
>> On Monday, 28 June 2021 at 01:12:51 UTC+1 hugh....@gmail.com wrote:
>>
>>> Update: 
>>>
>>> I did a re-installation of Go1.14.15. Reinstalled the FirebirdSQL 
>>> driver, yet the problem persist. 
>>>
>>> On Sunday, June 27, 2021 at 1:43:23 PM UTC-5 Hugh Myrie wrote:
>>>
>>>> The version I saw in the go.mod file was v0.9.1. However, looking at 
>>>> the modified date of the files in the library folder was last year. So I 
>>>> deleted the library and reinstalled it . I suppose doing a "go get" 
>>>> without 
>>>> specifying a version would retrieve the latest version. Correct me if I'm 
>>>> wrong here.
>>>>
>>>> I'm trying to get back to go1.14 to conduct further tests before making 
>>>> a standalone test.
>>>>
>>>> On Sun, Jun 27, 2021 at 4:03 AM Brian Candler <b.ca...@pobox.com> 
>>>> wrote:
>>>>
>>>>> On Sunday, 27 June 2021 at 03:27:28 UTC+1 hugh....@gmail.com wrote:
>>>>>
>>>>>> I agree. So far, I've Installed Go1.15, reinstalled the Firebird 
>>>>>> library. 
>>>>>
>>>>>
>>>>> Which version?  The latest tagged version (v0.9.1) or the tip of the 
>>>>> master branch?
>>>>>
>>>>> Having said that: the commit 
>>>>> <https://github.com/nakagami/firebirdsql/commit/ab7f07a652d65ac925b17003dcac22e377d810a8>
>>>>>  
>>>>> which changes the current supported version to 1.15, does nothing except 
>>>>> change the version number in go.mod; and it was applied immediately after 
>>>>> the v0.9.1 tag. 
>>>>>  
>>>>>
>>>>>> Compiled using Go1.15 and the problem persist.
>>>>>
>>>>>
>>>>> If you can make a standalone test program which replicates the 
>>>>> problem, then I suggest you open an issue on the firebirdsql repo.  All 
>>>>> developers love good reproducible bug reports with code that reproduces 
>>>>> the 
>>>>> bug :-)
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to a topic in the 
>>>>> Google Groups "golang-nuts" group.
>>>>> To unsubscribe from this topic, visit 
>>>>> https://groups.google.com/d/topic/golang-nuts/BHxTxzCpUB4/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>> golang-nuts...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/golang-nuts/6bb8c44e-e564-4685-aecf-7c8bffb3269cn%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/golang-nuts/6bb8c44e-e564-4685-aecf-7c8bffb3269cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> -- 
>>>> http://www.jaxtr.com/blessed_hope
>>>>
>>>

-- 
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/3f8b65ed-dc7c-4807-bd5a-7044f67d5b60n%40googlegroups.com.

Reply via email to