mariuz / flamerobin

FlameRobin is a database administration tool for Firebird RDBMS. Our goal is to build a tool that is: lightweight (small footprint, fast execution) cross-platform (Linux, Windows, Mac OS X, FreeBSD) dependent only on other Open Source software
http://flamerobin.org
MIT License
214 stars 66 forks source link

Implement Int128 #230

Closed andy-123 closed 2 years ago

andy-123 commented 2 years ago

FRInt128.cpp implements functions needed to work with int128. StringToInt128, Int128ToString and some others.

gcc build uses the buildin int128_t. msvc does not have some equivalent. so more work was needed (some overloads for int128)

arvanus commented 2 years ago

This select causes error: select 1.0*1.0 from rdb$database

Error: *** IBPP::WrongType ***
Context: RowImpl::GetValue
Message: Incompatible types.

INT128  and  double
arvanus commented 2 years ago

also, OK: select -170141183460469231731687303715884105728 as int128min, 170141183460469231731687303715884105727 as int128max from rdb$database Fail with same error: select -17014118346046923173168730371588410572.7 as int128minfail, 17014118346046923173168730371588410572.7 as int128maxfail from rdb$database


Error: *** IBPP::WrongType ***
Context: RowImpl::GetValue
Message: Incompatible types.

INT128  and  double
andy-123 commented 2 years ago

Thank you for reporting. I didn't notice it while testing. Fix is coming soon.

andy-123 commented 2 years ago

Should work now :)

arvanus commented 2 years ago

Nice! I'll give a try tonight (2-3 hours from now) and generate a snapshot! Thanks

arvanus commented 2 years ago

Almost! Got error selecting decfloat fields, can you take a loot at this? Thanks!

select 
       --OK: 
       -170141183460469231731687303715884105728, 
        170141183460469231731687303715884105727, 
       -17014118346046923173168730371588410572.7, 
        17014118346046923173168730371588410572.7,
        cast(1 as numeric(34)),
        cast(1 as numeric(38)),
        --Fail
        cast(1 as decfloat),
        cast(1 as decfloat(16)),
        cast(1 as decfloat(34)) from rdb$database
Error: *** IBPP::LogicException ***
Context: RowImpl::AllocVariables
Message: Found an unknown sqltype !
andy-123 commented 2 years ago

Yes. Decfloat is not implemented yet. I will do that in this PR. Thanks for the merge.