Hi,
I'm using sqlite3 TCL extension from Teapot (version 64-bit). When I try
to insert number bigger than signed 32-bit it inserts wrong number to
database.
Same code run with 32-bit version works fine.
Example in TCL console illustrating this issue:
% info patchlevel
8.6.4
% package require sqlite3
3.8.10.2
% set l1 [expr {2 ** 31 - 1}]
2147483647
% set l2 2147483649
2147483649
% set l3 [expr {$l1 + 2}]
2147483649
% ::tcl::unsupported::representation $l1
value is a int with a refcount of 3, object pointer at 00000000006CEB10,
internal representation 000000007FFFFFFF:0000000000000000, string
representation "2147483647"
% ::tcl::unsupported::representation $l2
value is a pure string with a refcount of 4, object pointer at
00000000006CE930, string representation "2147483649"
% ::tcl::unsupported::representation $l3
value is a wideInt with a refcount of 2, object pointer at
00000000006CF2F0, internal representation
0000000080000001:0000000000000000, string representation "2147483649"
% sqlite3 db C:/tmp/test.sqlite
% db eval {
CREATE TABLE test (num NUMERIC);
INSERT INTO test (num) VALUES ($l1), ($l2), ($l3);
SELECT * FROM test;
}
2147483647 2147483649 -2147483647
Regards,
RP.