Commit 4f1c0e2
committed
BUG#34728259: return unsafe numeric field values as strings
When retrieving records in a JSON column, if a field contains an unsafe
numeric value, it is parsed as a JavaScript number from the
corresponding result set. This means that applications are dealing with
values that are loosing precision.
The reason for this to happen is that the connector is parsing JSON
strings as their corresponding plain JavaScript object counterparts for
the sake of convenience. This creates a problem wherein the native
"JSON.parse()" API automatically coerces a numeric value of a field to
the a JavaScript number and there is no way to override that behavior,
even using a "reviver", because the value is already coerced by that
point.
This patch addresses the issue by introducing a 3rd-party JSON parser
which is capable of "reviving" unsafe big numbers (which loose precision
when represented by JavaScript numbers), or even all numeric values as
JavaScript strings. This is the strategy already in place to parse
unsafe numeric values from explicit column data types such as BIGINT and
DECIMAL.
Change-Id: I30ad08d6088cf4d7388ec78d71c63119de5e34ad1 parent db1b258 commit 4f1c0e2
File tree
8 files changed
+194
-19
lines changed- lib
- Protocol/Wrappers/Messages/Resultset
- test
- functional/default
- document-store
- relational-tables
- unit
8 files changed
+194
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
93 | 113 | | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
611 | 630 | | |
612 | 631 | | |
613 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
564 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
565 | 566 | | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
570 | 571 | | |
571 | 572 | | |
572 | 573 | | |
573 | 574 | | |
574 | | - | |
| 575 | + | |
575 | 576 | | |
576 | 577 | | |
577 | 578 | | |
578 | 579 | | |
579 | | - | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
905 | 908 | | |
906 | 909 | | |
907 | 910 | | |
908 | 911 | | |
909 | 912 | | |
910 | | - | |
911 | | - | |
| 913 | + | |
| 914 | + | |
912 | 915 | | |
913 | 916 | | |
914 | 917 | | |
| |||
917 | 920 | | |
918 | 921 | | |
919 | 922 | | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
920 | 933 | | |
921 | 934 | | |
922 | 935 | | |
| |||
1156 | 1169 | | |
1157 | 1170 | | |
1158 | 1171 | | |
1159 | | - | |
1160 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1161 | 1175 | | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1166 | 1180 | | |
1167 | 1181 | | |
1168 | 1182 | | |
1169 | 1183 | | |
1170 | | - | |
| 1184 | + | |
1171 | 1185 | | |
1172 | 1186 | | |
1173 | 1187 | | |
1174 | 1188 | | |
1175 | | - | |
| 1189 | + | |
1176 | 1190 | | |
1177 | 1191 | | |
1178 | 1192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments