From 6e064bb4ce97bc7ad9f7b0cff6797db107a79cc5 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 24 Jul 2012 02:59:21 -0400 Subject: [PATCH] Avoid excessive calls to XPCWrappedNative::GetWrappedNativeOfJSObject when determining field type --- chrome/content/zotero/xpcom/db.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 5a1775dc9..b70a16c29 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -1244,16 +1244,17 @@ Zotero.DBConnection.prototype._debug = function (str, level) { Zotero.DBConnection.prototype._getTypedValue = function (statement, i) { var type = statement.getTypeOfIndex(i); + // For performance, we hard-code these constants switch (type) { - case statement.VALUE_TYPE_INTEGER: + case 1: //VALUE_TYPE_INTEGER return statement.getInt64(i); - case statement.VALUE_TYPE_TEXT: + case 3: //VALUE_TYPE_TEXT return statement.getUTF8String(i); - case statement.VALUE_TYPE_NULL: + case 0: //VALUE_TYPE_NULL return null; - case statement.VALUE_TYPE_FLOAT: + case 2: //VALUE_TYPE_FLOAT return statement.getDouble(i); - case statement.VALUE_TYPE_BLOB: + case 4: //VALUE_TYPE_BLOB return statement.getBlob(i, {}); } }