www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit dd776bbb706f69ed2a054241d5d5a4d973082b83
parent d5eacdcbc6d511c87e248b6ce638e0f7bc92138c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 18 Jun 2008 08:49:44 +0000

Use SQLite text data type for integers longer than 15 characters


Diffstat:
Mchrome/content/zotero/xpcom/utilities.js | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -262,6 +262,13 @@ Zotero.Utilities.prototype.isInt = function(x) { Zotero.Utilities.prototype.getSQLDataType = function(value) { var strVal = value + ''; if (strVal.match(/^[1-9]+[0-9]*$/)) { + // 2^53 (9007199254740992) is JS's upper-bound for decimal integers, + // but since integer comparisons above that won't work, + // we use a string past 15 digits + if (strVal.length > 15) { + return 0; + } + // These upper bounds also specified in Zotero.DB // // Store as 32-bit signed integer @@ -269,8 +276,7 @@ Zotero.Utilities.prototype.getSQLDataType = function(value) { return 32; } // Store as 64-bit signed integer - // 2^53 is JS's upper-bound for decimal integers - else if (value < 9007199254740992) { + else { return 64; } }