mysql2sqlite
mysql2sqlite copied to clipboard
Hex numbers inside strings are trimmed
If you have a string that has a long hex number in it, the script will trim it to be 16 characters.
Example:
INSERT INTO `test` VALUES(1,2,'0x00000000000000003');
will result in the warning
1: WARN Hex number trimmed (length longer than 16 chars).
and the output SQL will be
INSERT INTO `test` VALUES(1,2,'0x0000000000000000');
That's a deliberate check in the conversion script - see the source code:
# sqlite3 is limited to 16 significant digits of precision
Maybe there are some Sqlite3 versions out there which support more digits, but I don't know about them. Feel free to remove the check or increase the number, convert your DB and try to load it into Sqlite3 and if OK, then check all the numbers whether they were correctly imported.
The problem isn't trimming the number, that is correct, but it's trimming the number inside strings.
0x00000000000000003 is the number 3, '0x00000000000000003' is a string containing 0x00000000000000003
I think it should also probably be smarter about how it trims numbers, sqlite handles the hex literal 0x00000000000000003 completely fine, since it's actually only 1 digit long, the script should probably trim any leading 0s before calculating the length.
This issue is linked to #69