Skip to content

Commit 981960b

Browse files
charmanderbrianc
authored andcommitted
Remove confusing conditions (brianc#1159)
* Remove unreachable code * Remove redundant condition Every path with `!this.values` results in `false` regardless of `this.binary`.
1 parent 48a9738 commit 981960b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

lib/query.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ Query.prototype.requiresPreparation = function() {
6565
if(this.rows) { return true; }
6666
//don't prepare empty text queries
6767
if(!this.text) { return false; }
68-
//binary should be prepared to specify results should be in binary
69-
//unless there are no parameters
70-
if(this.binary && !this.values) { return false; }
7168
//prepare if there are values
72-
return (this.values || 0).length > 0;
69+
if(!this.values) { return false; }
70+
return this.values.length > 0;
7371
};
7472

7573

lib/utils.js

-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ var prepareValue = function(val, seen) {
6464
if(typeof val === 'object') {
6565
return prepareObject(val, seen);
6666
}
67-
if (typeof val === 'undefined') {
68-
throw new Error('SQL queries with undefined where clause option');
69-
}
7067
return val.toString();
7168
};
7269

0 commit comments

Comments
 (0)