sijms / go-ora

Pure go oracle client
MIT License
767 stars 168 forks source link

Incorrect integer values due to float64 conversion #516

Closed robstradling closed 3 months ago

robstradling commented 4 months ago

Due to the float64(val) conversion at https://github.com/sijms/go-ora/blob/master/v2/utils.go#L591, int64 values can get "corrupted".

Demo at https://gist.github.com/robstradling/363b54e979b879e0450cfa36e238cca6

Interestingly, if I remove the int64 case at https://github.com/sijms/go-ora/blob/master/v2/utils.go#L590, my sql.NullInt64 test case then works correctly, presumably because the sql.Scanner stuff in the default case doesn't do a floating point conversion.

sijms commented 4 months ago

I will use new type Number to hold all number variety and solve these issues

add2ws commented 3 months ago

Please fix this quickly

sijms commented 3 months ago

I add changes in last commit would you please test and give me feedback

robstradling commented 3 months ago

Thanks @sijms. Commit https://github.com/sijms/go-ora/commit/b04862ca3078dc46907e4e8a566507bd505af880 fixes my demo and looks good to me. Time for a v2.8.10 release?