On 03/11/18 18:12, Mark Rotteveel wrote:
I some changes were made in
https://github.com/FirebirdSQL/firebird/commit/1636227d401f3c7e9678dc8cd317af5fae9a56bc
I'm observing something odd. It is my understanding it would be
possible to drop use of blr_dec_fixed, and use blr_dec128 instead.
If I define the BLR message descriptor using:
case SQL_DEC_FIXED:
bout.write(blr_dec_fixed);
bout.write(field.getScale());
break;
It works as expected, but when I change it to
case SQL_DEC_FIXED:
bout.write(blr_dec128);
break;
We were always talking about format of the number (making it possible to
use same code for DecFloat(34) and high precision numerics), not about
changing BLR codes.
I get incorrect results, that is: it behaves as if I wrote
bout.write(blr_dec_fixed);
bout.write(0);
on parameters sent from client to server, but as
bout.write(blr_dec_fixed);
bout.write(field.getScale());
on fetch for values from server to client.
Inserting a value like 12345678901234567.891 into a DECIMAL(19,3) then
results in the value 12345678901234567891.000 being inserted (and
returned to the client on select).
So it looks like there is something missing when receiving parameter
values from the client.
ISQL in bulk insert mode (i.e. when it does use parameters) inserts into
high precision numeric column correctly:
show table dec_x;
D16 DECFLOAT(16) Nullable
D34 DECFLOAT(34) Nullable
S_P2 NUMERIC(24, 4) Nullable
S_0 NUMERIC(24, 0) Nullable
S_M2 NUMERIC(24, 22) Nullable
SQL> set bulk_insert INSERT INTO DEC_X(S_P2) values(?);
BULK> (1234567890123456.7891)
BULK> stop
SQL> commit;
SQL> select * from dec_x;
D16 <null>
D34 <null>
S_P2 1234567890123456.7891
S_0 <null>
S_M2 <null>
SQL>
Also, it would be helpful if CORE-5728 (Field subtype of DEC_FIXED
columns not returned by isc_info_sql_sub_type) gets done soon.
To be fixed soon.
I've started from the most serious changes (may be except fixing
literals behavior - even not clear what to do with literal node here).
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel