From 49da992285fe302d3c6e8bbfd8192f1832a16831 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 5 Apr 2013 01:19:05 -0400 Subject: [PATCH] Fix queryMethod error --- chrome/content/zotero/xpcom/db.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index a1b90145fb..07f0cf18c1 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -247,10 +247,6 @@ Zotero.DBConnection.prototype.getStatement = function (sql, params, checkParams) throw ("Cannot access database layer from a higher wait level if a transaction is open"); } - // First, determine the type of query using first word - var matches = sql.match(/^[^\s\(]*/); - var queryMethod = matches[0].toLowerCase(); - [sql, params] = this.parseQueryAndParams(sql, params); try { @@ -372,6 +368,10 @@ Zotero.DBConnection.prototype.getStatement = function (sql, params, checkParams) Zotero.DBConnection.prototype.parseQueryAndParams = function (sql, params) { if (params) { + // First, determine the type of query using first word + var matches = sql.match(/^[^\s\(]*/); + var queryMethod = matches[0].toLowerCase(); + // If single scalar value or single non-array object, wrap in an array if (typeof params != 'object' || params === null || (typeof params == 'object' && !params.length)) {