commit 21a2188caa9951f34a0fe73a31a882c20aac6668
parent acdc36c9a1197e4ba4478f0a66d4db8f72e3c06e
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 25 Oct 2010 00:17:53 +0000
move getSQLDataType to Z.DB
Diffstat:
3 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -1265,7 +1265,7 @@ Zotero.Item.prototype.save = function() {
value = Zotero.DB.transactionDateTime;
}
- var dataType = ZU.getSQLDataType(value);
+ var dataType = Zotero.DB.getSQLDataType(value);
switch (dataType) {
case 32:
@@ -1598,7 +1598,7 @@ Zotero.Item.prototype.save = function() {
value = Zotero.DB.transactionDateTime;
}
- var dataType = ZU.getSQLDataType(value);
+ var dataType = Zotero.DB.getSQLDataType(value);
switch (dataType) {
case 32:
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js
@@ -1010,6 +1010,30 @@ Zotero.DBConnection.prototype.stopDummyStatement = function () {
}
+/**
+ * Determine the necessary data type for SQLite parameter binding
+ *
+ * @return int 0 for string, 32 for int32, 64 for int64
+ */
+Zotero.DBConnection.prototype.getSQLDataType = function(value) {
+ var strVal = value + '';
+ if (strVal.match(/^[1-9]+[0-9]*$/)) {
+ // These upper bounds also specified in Zotero.DB
+ //
+ // Store as 32-bit signed integer
+ if (value <= 2147483647) {
+ return 32;
+ }
+ // Store as 64-bit signed integer
+ // 2^53 is JS's upper-bound for decimal integers
+ else if (value < 9007199254740992) {
+ return 64;
+ }
+ }
+ return 0;
+}
+
+
/////////////////////////////////////////////////////////////////
//
// Private methods
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js
@@ -379,30 +379,6 @@ Zotero.Utilities.prototype.rand = function (min, max) {
}
-/**
- * Determine the necessary data type for SQLite parameter binding
- *
- * @return int 0 for string, 32 for int32, 64 for int64
- */
-Zotero.Utilities.prototype.getSQLDataType = function(value) {
- var strVal = value + '';
- if (strVal.match(/^[1-9]+[0-9]*$/)) {
- // These upper bounds also specified in Zotero.DB
- //
- // Store as 32-bit signed integer
- if (value <= 2147483647) {
- return 32;
- }
- // Store as 64-bit signed integer
- // 2^53 is JS's upper-bound for decimal integers
- else if (value < 9007199254740992) {
- return 64;
- }
- }
- return 0;
-}
-
-
/*
* Adapted from http://developer.mozilla.org/en/docs/nsICryptoHash
*