storesafe/cordova-sqlite-storage

Extremely large/small values

brodybits opened this issue · 1 comments

A client asked about supporting NUMERIC/INTEGER values greater than 2^53 (up to 2^63-1) using https://github.com/peterolson/BigInteger.js. (Note that NUMERIC and INTEGER column affinity are almost the same ref: https://www.sqlite.org/datatype3.html#type_affinity.) The solution for storing the big integer value is to simply use the BigInteger object in the SQL parameters. In JavaScript the BigInteger.toString function would be called automatically and then SQLite would convert the string value to an integer for storage. To retrieve the value as a string to be handled by BigInteger the CAST expression is used as described in the accepted answer to http://stackoverflow.com/questions/12419693/convert-integer-to-text-in-sqlites-select-query. This should work the same way in the case of both Web SQL and this plugin.

For further investigation: