ee-query-builder
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -72,3 +72,6 @@ !function(){ | ||
case 'delete': | ||
return this._buildDeleteQuery(query, parameters); | ||
default: | ||
@@ -80,2 +83,21 @@ throw new Error('Unknown query mode «'+mode+'»!').setName('InvalidModeException'); | ||
, _buildDeleteQuery: function(query, parameters) { | ||
var SQLString = 'DELETE FROM ' | ||
, keys = [] | ||
, values = []; | ||
// from | ||
SQLString += this._renderFrom(query.database, query.from); | ||
SQLString += ' WHERE ' + (this._renderFilter(parameters, query.filter || {}) || 1); | ||
if(query.limit && !isNaN(parseInt(query.limit, 10))) SQLString += ' LIMIT ' + parseInt(query.limit, 10); | ||
if(query.offset && !isNaN(parseInt(query.offset, 10))) SQLString += ' OFFSET ' + parseInt(query.offset, 10); | ||
return {SQLString: SQLString, parameters: parameters}; | ||
} | ||
, _buildInsertQuery: function(query, parameters) { | ||
@@ -119,2 +141,5 @@ var SQLString = 'INSERT INTO ' | ||
if(query.limit && !isNaN(parseInt(query.limit, 10))) SQLString += ' LIMIT ' + parseInt(query.limit, 10); | ||
if(query.offset && !isNaN(parseInt(query.offset, 10))) SQLString += ' OFFSET ' + parseInt(query.offset, 10); | ||
return {SQLString: SQLString, parameters: parameters}; | ||
@@ -138,3 +163,3 @@ } | ||
// render filter (where statement) | ||
SQLString += ' WHERE ' + (this._renderFilter(parameters, query.filter || {}) || 1); | ||
if (query.filter && Object.keys(query.filter).length) SQLString += ' WHERE ' + (this._renderFilter(parameters, query.filter || {}) || 1); | ||
@@ -141,0 +166,0 @@ // render order statement |
{ | ||
"name" : "ee-query-builder" | ||
, "description" : "query builder for ee-orm" | ||
, "version" : "0.1.1" | ||
, "version" : "0.1.2" | ||
, "homepage" : "https://github.com/eventEmitter/ee-query-builder" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16212
366