Skip to content

Implement Int128#230

Merged
mariuz merged 4 commits into
mariuz:masterfrom
andy-123:int128b
Dec 14, 2021
Merged

Implement Int128#230
mariuz merged 4 commits into
mariuz:masterfrom
andy-123:int128b

Conversation

@andy-123

@andy-123 andy-123 commented Oct 3, 2021

Copy link
Copy Markdown
Contributor

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)

gcc uses the buildin int128_t. msvc does not have some equivalent. so more work was needed.
@arvanus

arvanus commented Oct 4, 2021

Copy link
Copy Markdown
Collaborator

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

arvanus commented Oct 4, 2021

Copy link
Copy Markdown
Collaborator

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

andy-123 commented Oct 4, 2021

Copy link
Copy Markdown
Contributor Author

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

gcc uses the buildin int128_t. msvc does not have some equivalent. so more work was needed.
* for numeric columns returned as int128 by firebird Int128ColumnDef is now used
  * for this purpose a scale parameter was added to the Int128ColumnDef constructor
* move some code from FRInt128.h to ibbp.h and from FRInt128.cpp to ibint128.cpp.
@andy-123

Copy link
Copy Markdown
Contributor Author

Should work now :)

@arvanus

arvanus commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

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

@arvanus

arvanus commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

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

andy-123 commented Oct 19, 2021

Copy link
Copy Markdown
Contributor Author

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

@mariuz
mariuz merged commit c7e52c0 into mariuz:master Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants