commit 93c15fc061e8a4ded9da0d9aa3820b395bf48aaa
parent 302f0105bff1c29d75e00837bfb8f8814f075d8f
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 20 Sep 2006 23:20:11 +0000
Allow for single objects as bound parameters without wrapping in array (e.g. DB.query(sql, {string:isbn}))
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/db.js b/chrome/chromeFiles/content/scholar/xpcom/db.js
@@ -171,8 +171,10 @@ Scholar.DB = new function(){
}
if (statement && params){
- // If single parameter, wrap in an array
- if (typeof params != 'object' || params===null){
+ // If single scalar value or single object, wrap in an array
+ if ((typeof params != 'object' || params===null) ||
+ (params && typeof params == 'object' &&
+ params.constructor != Array)){
params = [params];
}
@@ -231,6 +233,7 @@ Scholar.DB = new function(){
Scholar.debug('Binding parameter ' + (i+1)
+ ' of type NULL', 5);
statement.bindNullParameter(i);
+ break;
}
}
}