www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0ac7a7738182711769826a86d6cfc8a046816a9e
parent 995369bc9b4b48558e57b2dff4c2831587817f15
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 12 Aug 2013 04:12:10 -0400

Show bound parameters for async queries

Diffstat:
Mchrome/content/zotero/xpcom/db.js | 30+++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js @@ -854,7 +854,15 @@ Zotero.DBConnection.prototype.queryAsync = function (sql, params) { then(function (c) { conn = c; [sql, params] = self.parseQueryAndParams(sql, params); - Zotero.debug(sql, 5); + if (Zotero.Debug.enabled) { + Zotero.debug(sql, 5); + for each(let param in params) { + let paramType = typeof param; + let msg = "Binding parameter of type " + paramType + ": "; + msg += paramType == 'string' ? "'" + param + "'" : param; + Zotero.debug(msg, 5); + } + } return conn.executeCached(sql, params); }) .then(function (rows) { @@ -912,7 +920,15 @@ Zotero.DBConnection.prototype.valueQueryAsync = function (sql, params) { return this._getConnectionAsync(). then(function (conn) { [sql, params] = self.parseQueryAndParams(sql, params); - Zotero.debug(sql, 5); + if (Zotero.Debug.enabled) { + Zotero.debug(sql, 5); + for each(let param in params) { + let paramType = typeof param; + let msg = "Binding parameter of type " + paramType + ": "; + msg += paramType == 'string' ? "'" + param + "'" : param; + Zotero.debug(msg, 5); + } + } return conn.executeCached(sql, params); }) .then(function (rows) { @@ -960,7 +976,15 @@ Zotero.DBConnection.prototype.columnQueryAsync = function (sql, params) { then(function (c) { conn = c; [sql, params] = self.parseQueryAndParams(sql, params); - Zotero.debug(sql, 5); + if (Zotero.Debug.enabled) { + Zotero.debug(sql, 5); + for each(let param in params) { + let paramType = typeof param; + let msg = "Binding parameter of type " + paramType + ": "; + msg += paramType == 'string' ? "'" + param + "'" : param; + Zotero.debug(msg, 5); + } + } return conn.executeCached(sql, params); }) .then(function (rows) {