hapiest-mysql
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -196,2 +196,4 @@ 'use strict'; | ||
sqlObject = sqlObject.where(`${columnName} IS NULL`); | ||
} else if (cleanValue === 'IS NULL' || cleanValue === 'IS NOT NULL') { | ||
sqlObject = sqlObject.where(`${columnName} ${cleanValue}`); | ||
} else { | ||
@@ -198,0 +200,0 @@ sqlObject = sqlObject.where(`${columnName} = ${cleanValue}`); |
{ | ||
"name": "hapiest-mysql", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "A wrapper around mysql that provides a very descriptive way of running queries.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -372,4 +372,15 @@ 'use strict'; | ||
it('Should generate good WHERE clause when input contains special functions', function() { | ||
const sqlObj = Squel.select().from('users'); | ||
const someObj = {firstName: 'John'}; | ||
mysqlDaoQueryHelper._appendWhereClause(sqlObj, {dateCreated: 'CURRENT_TIMESTAMP', dateUpdated: 'NOW()', email: 'IS NULL', firstName: 'IS NOT NULL'}); | ||
const sqlString = sqlObj.toString(); | ||
sqlString.should.eql("SELECT * FROM users WHERE (date_created = CURRENT_TIMESTAMP) AND (date_updated = NOW()) AND (email IS NULL) AND (first_name IS NOT NULL)"); | ||
}); | ||
}); | ||
}); |
137752
3090