Comparing version 1.1.0 to 1.2.0
@@ -13,3 +13,5 @@ /* SQB | ||
*/ | ||
const merge = require('putil-merge'); | ||
const ParamType = require('./enums').ParamType; | ||
const ReservedWords = [ | ||
@@ -151,2 +153,3 @@ 'schema', 'table', 'field', 'index', | ||
const prmValue = ctx.values[name]; | ||
ctx.prmValue = prmValue == null ? null : prmValue; | ||
switch (ctx.paramType) { | ||
@@ -157,11 +160,11 @@ case ParamType.COLON: | ||
const symb = ctx.paramType === ParamType.COLON ? ':' : '@'; | ||
ctx.outValues[name] = prmValue == null ? null : prmValue; | ||
ctx.outValues[name] = ctx.prmValue; | ||
return symb + name; | ||
} | ||
case ParamType.DOLLAR: { | ||
ctx.outValues.push(prmValue == null ? null : prmValue); | ||
ctx.outValues.push(ctx.prmValue); | ||
return '$' + (ctx.outValues.length); | ||
} | ||
case ParamType.QUESTION_MARK: { | ||
ctx.outValues.push(prmValue == null ? null : prmValue); | ||
ctx.outValues.push(ctx.prmValue); | ||
return '?'; | ||
@@ -168,0 +171,0 @@ } |
@@ -39,2 +39,4 @@ /* SQB | ||
CompOperator.prototype._serialize = function(ctx) { | ||
const self = this; | ||
ctx.operatorType = self.operatorType; | ||
@@ -46,12 +48,17 @@ const serializeValue = function(val) { | ||
operatorType: this.operatorType, | ||
expression: | ||
this._expression.isSerializable ? | ||
(this._expression.isQuery ? | ||
'(' + this._expression._serialize(ctx) + ')' : | ||
this._expression._serialize(ctx)) : | ||
String(this._expression), | ||
value1: serializeValue(this._value1), | ||
value2: this._value2 ? serializeValue(this._value2) : null | ||
expression: this._expression.isSerializable ? | ||
(this._expression.isQuery ? | ||
'(' + this._expression._serialize(ctx) + ')' : | ||
this._expression._serialize(ctx)) : | ||
String(this._expression) | ||
}; | ||
const self = this; | ||
ctx.operatorValue1 = this._value1; | ||
o.value1 = serializeValue(ctx.operatorValue1); | ||
ctx.prmValue1 = ctx.prmValue; | ||
delete ctx.prmValue; | ||
ctx.operatorValue2 = this._value2 ? serializeValue(this._value2) : null; | ||
o.value2 = ctx.operatorValue2; | ||
ctx.prmValue2 = ctx.prmValue; | ||
delete ctx.prmValue; | ||
return Serializable.serializeFallback(ctx, 'operator', o, function() { | ||
@@ -58,0 +65,0 @@ return self.__serialize(ctx, o); |
@@ -62,3 +62,3 @@ /* SQB | ||
}); | ||
return Serializable.serializeFallback(ctx, 'operator_and', arr, function() { | ||
return Serializable.serializeFallback(ctx, 'operator', arr, function() { | ||
var s = Serializable.joinArray(arr, ' and'); | ||
@@ -65,0 +65,0 @@ return (s.indexOf('n') > 0) ? s.replace('\n', '\n\t') + '\b' : s; |
@@ -28,3 +28,4 @@ /* SQB | ||
CompOperator.apply(this, [expression, | ||
Array.isArray(value) || value instanceof RegExp ? value : [value]]); | ||
Array.isArray(value) || value instanceof RegExp ? | ||
value : [value]]); | ||
} | ||
@@ -31,0 +32,0 @@ |
@@ -62,3 +62,3 @@ /* SQB | ||
}); | ||
return Serializable.serializeFallback(ctx, 'operator_or', arr, function() { | ||
return Serializable.serializeFallback(ctx, 'operator', arr, function() { | ||
var s = Serializable.joinArray(arr, ' or'); | ||
@@ -65,0 +65,0 @@ return (s.indexOf('n') > 0) ? s.replace('\n', '\n\t') + '\b' : s; |
{ | ||
"name": "sqb", | ||
"description": "Extensible, multi-dialect SQL query builder and Database connection framework for JavaScript", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
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
126276
4274