From 981960b445c041ad8c97c631470b5e5c367eb60f Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Tue, 13 Dec 2016 05:50:07 -0800 Subject: [PATCH] Remove confusing conditions (#1159) * Remove unreachable code * Remove redundant condition Every path with `!this.values` results in `false` regardless of `this.binary`. --- lib/query.js | 6 ++---- lib/utils.js | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/query.js b/lib/query.js index 9e474d12..36d52ba7 100644 --- a/lib/query.js +++ b/lib/query.js @@ -65,11 +65,9 @@ Query.prototype.requiresPreparation = function() { if(this.rows) { return true; } //don't prepare empty text queries if(!this.text) { return false; } - //binary should be prepared to specify results should be in binary - //unless there are no parameters - if(this.binary && !this.values) { return false; } //prepare if there are values - return (this.values || 0).length > 0; + if(!this.values) { return false; } + return this.values.length > 0; }; diff --git a/lib/utils.js b/lib/utils.js index 017aa5cd..861b7c5b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -64,9 +64,6 @@ var prepareValue = function(val, seen) { if(typeof val === 'object') { return prepareObject(val, seen); } - if (typeof val === 'undefined') { - throw new Error('SQL queries with undefined where clause option'); - } return val.toString(); };