Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

add "not like" pairs #102

Open
wants to merge 2 commits into
base: 0.5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "waterline-sequel",
"description": "A helper library for generating SQL queries from the Waterline Query Language.",
"version": "0.5.7",
"version": "0.5.8",
"author": "Cody Stoltman <particlebanana@gmail.com>",
"url": "http://github.com/balderdashy/waterline-sequel",
"keywords": [],
Expand Down
25 changes: 25 additions & 0 deletions sequel/lib/criteriaProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,31 @@ CriteriaProcessor.prototype.prepareCriterion = function prepareCriterion(key, va
}

break;

case 'not like':

if(this.caseSensitive) {
comparator = 'INOT LIKE';
}
else {
comparator = 'NOT LIKE';
}

// Override comparator with WL Next features
if(hop(self.wlNext, 'caseSensitive') && self.wlNext.caseSensitive) {
comparator = 'NOT LIKE';
}

if(this.parameterized) {
this.values.push(value);
str = comparator + ' ' + '$' + this.paramCount;
}
else {
// Note that wildcards are not escaped out of NOT like criterion intentionally
str = comparator + ' "' + utils.escapeString(value) + '"';
}

break;

case 'contains':

Expand Down