ee-query-builder
Advanced tools
Comparing version 0.1.26 to 0.1.27
!function(){ | ||
var Class = require('ee-class') | ||
, log = require('ee-log') | ||
, type = require('ee-types'); | ||
var Class = require('ee-class') | ||
, log = require('ee-log') | ||
, type = require('ee-types'); | ||
module.exports = new Class({ | ||
aggregateFunctions: { | ||
avg : 'AVG' | ||
, sum : 'SUM' | ||
, min : 'MIN' | ||
, max : 'MAX' | ||
, count : 'COUNT' | ||
} | ||
module.exports = new Class({ | ||
aggregateFunctions: { | ||
avg : 'AVG' | ||
, sum : 'SUM' | ||
, min : 'MIN' | ||
, max : 'MAX' | ||
, count : 'COUNT' | ||
} | ||
, init: function(options){ | ||
this._escapeId = options.escapeId; | ||
this._escape = options.escape; | ||
this._queryBuilder = options.queryBuilder; | ||
} | ||
, init: function(options){ | ||
this._escapeId = options.escapeId; | ||
this._escape = options.escape; | ||
this._type = options.type; | ||
this._queryBuilder = options.queryBuilder; | ||
} | ||
, renderSelectFunction: function(tablename, command) { | ||
return this.aggregateFunctions[command.fn]+'('+this._escapeId(tablename)+'.'+this._escapeId(command.value)+')'+(command.alias ? ' AS '+this._escapeId(command.alias) : ''); | ||
} | ||
, renderSelectFunction: function(tablename, command) { | ||
return this.aggregateFunctions[command.fn]+'('+this._escapeId(tablename)+'.'+this._escapeId(command.value)+')'+(command.alias ? ' AS '+this._escapeId(command.alias) : ''); | ||
} | ||
, in: function(command, paramaters) { | ||
var values = command.values; | ||
, in: function(command, paramaters) { | ||
var values = command.values; | ||
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0]; | ||
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0]; | ||
//if (command.values.length) { | ||
if (type.function(values.isQuery)) { | ||
return ' IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')'; | ||
} | ||
else { | ||
return ' IN (' +values.map(function(value) { | ||
return this._escape(value); | ||
}.bind(this)).join(', ') +')'; | ||
} | ||
//} | ||
} | ||
//if (command.values.length) { | ||
if (type.function(values.isQuery)) { | ||
return ' IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')'; | ||
} | ||
else { | ||
return ' IN (' +values.map(function(value) { | ||
return this._escape(value); | ||
}.bind(this)).join(', ') +')'; | ||
} | ||
//} | ||
} | ||
, notIn: function(command, paramaters) { | ||
var values = command.values; | ||
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0]; | ||
if (type.function(values.isQuery)) { | ||
return ' NOT IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')'; | ||
} | ||
else { | ||
return ' NOT IN (' +values.map(function(value){ | ||
return this._escape(value); | ||
}.bind(this)).join(', ') +')'; | ||
} | ||
} | ||
, notIn: function(command, paramaters) { | ||
var values = command.values; | ||
if (type.array(command.values) && command.values.length && type.function(command.values[0].isQuery)) values = values[0]; | ||
if (type.function(values.isQuery)) { | ||
return ' NOT IN ('+this._queryBuilder._render('query', this._queryBuilder._prepareQueryFilter(values), paramaters).SQLString+')'; | ||
} | ||
else { | ||
return ' NOT IN (' +values.map(function(value){ | ||
return this._escape(value); | ||
}.bind(this)).join(', ') +')'; | ||
} | ||
} | ||
, like: function(command) { | ||
return ' LIKE '+this._escape(command.value); | ||
} | ||
, like: function(command) { | ||
return ' '+(this._type === 'postgres' ? 'I' : '')+'LIKE '+this._escape(command.value); | ||
} | ||
, notLike: function(command) { | ||
return ' NOT LIKE '+this._escape(command.value); | ||
} | ||
, notLike: function(command) { | ||
return ' NOT '+(this._type === 'postgres' ? 'I' : '')+'LIKE '+this._escape(command.value); | ||
} | ||
, 'null': function(){ | ||
return ' is null'; | ||
} | ||
, 'null': function(){ | ||
return ' is null'; | ||
} | ||
, 'notNull': function(){ | ||
return ' is not null'; | ||
} | ||
}); | ||
, 'notNull': function(){ | ||
return ' is not null'; | ||
} | ||
}); | ||
}(); |
{ | ||
"name" : "ee-query-builder" | ||
, "description" : "query builder for ee-orm" | ||
, "version" : "0.1.26" | ||
, "version" : "0.1.27" | ||
, "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
20899
469