Avoid excessive calls to XPCWrappedNative::GetWrappedNativeOfJSObject when determining field type

This commit is contained in:
Simon Kornblith 2012-07-24 02:59:21 -04:00
parent c0c5695bf2
commit 6e064bb4ce

View file

@ -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, {});
}
}