sijms / go-ora

Pure go oracle client
MIT License
771 stars 169 forks source link

time.Time writing behavior changed causes wrong value #494

Closed freeNestor closed 6 months ago

freeNestor commented 6 months ago

Sorry, when use 2.7.20 version, we have writing time.Time value code like below and query value is ok after writing:

                if val != nil {
                    valt, err = TryParseDateTime(val.(string), timeloc)
                    if err != nil {
                        return fmt.Errorf("data parsed failed:%s - %v", colname, err)
                    }
                    t := new(go_ora.TimeStamp)
                    t.Scan(valt)
                    bind.bindti = append(bind.bindti, go_ora.NullTimeStamp{TimeStamp: *t, Valid: true})
                } else {
                    bind.bindti = append(bind.bindti, go_ora.NullTimeStamp{})
                }           

but we test new version 2.8.4, this situation is changed:

right value: 2024-01-03 16:21:32.787283
query value after writing:2024-01-04 00:21:32.787283

so is there some advises or solution? Did we miss something? We tried time.Time/sql.NullTime/go_ora.NullTimeStampTZ, same result.

sijms commented 6 months ago

this issue occur during fixation of issue #475 which suggest using time.Time{} as input for DATE, TIMESTAMP and TIMESTAMP WITH TIMEZONE

sijms commented 6 months ago

fixed in next version (revert back to old style)

sijms commented 6 months ago

still there is some issue related to timestamp with time zone and timestamp with local time zone i am working on it and will be fixed in next release

sijms commented 6 months ago

fixed in v2.8.6 testing file time_test.go