squel 5.11.1 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +13 -7
- package/dist/squel-basic.js +249 -276
- package/dist/squel-basic.min.js +2 -2
- package/dist/squel.js +337 -364
- package/dist/squel.min.js +2 -2
- package/gulpfile.js +2 -5
- package/package.json +6 -2
- package/performance/select.js +22 -0
package/dist/squel.js
CHANGED
|
@@ -13,7 +13,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec
|
|
|
13
13
|
|
|
14
14
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
15
15
|
|
|
16
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
16
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
17
17
|
|
|
18
18
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
19
19
|
|
|
@@ -33,23 +33,23 @@ function _extend(dst) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (dst && sources) {
|
|
36
|
+
var _loop = function _loop(src) {
|
|
37
|
+
if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') {
|
|
38
|
+
Object.getOwnPropertyNames(src).forEach(function (key) {
|
|
39
|
+
dst[key] = src[key];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
36
44
|
var _iteratorNormalCompletion = true;
|
|
37
45
|
var _didIteratorError = false;
|
|
38
46
|
var _iteratorError = undefined;
|
|
39
47
|
|
|
40
48
|
try {
|
|
41
|
-
var
|
|
49
|
+
for (var _iterator = sources[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
42
50
|
var src = _step.value;
|
|
43
51
|
|
|
44
|
-
|
|
45
|
-
Object.getOwnPropertyNames(src).forEach(function (key) {
|
|
46
|
-
dst[key] = src[key];
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
for (var _iterator = sources[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
52
|
-
_loop();
|
|
52
|
+
_loop(src);
|
|
53
53
|
}
|
|
54
54
|
} catch (err) {
|
|
55
55
|
_didIteratorError = true;
|
|
@@ -89,21 +89,15 @@ function _clone(src) {
|
|
|
89
89
|
if (typeof src.clone === 'function') {
|
|
90
90
|
return src.clone();
|
|
91
91
|
} else if (_isPlainObject(src) || _isArray(src)) {
|
|
92
|
-
var
|
|
93
|
-
var ret = new src.constructor();
|
|
92
|
+
var ret = new src.constructor();
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
v: ret
|
|
103
|
-
};
|
|
104
|
-
}();
|
|
94
|
+
Object.getOwnPropertyNames(src).forEach(function (key) {
|
|
95
|
+
if (typeof src[key] !== 'function') {
|
|
96
|
+
ret[key] = _clone(src[key]);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
105
99
|
|
|
106
|
-
|
|
100
|
+
return ret;
|
|
107
101
|
} else {
|
|
108
102
|
return JSON.parse(JSON.stringify(src));
|
|
109
103
|
}
|
|
@@ -181,7 +175,7 @@ function _getValueHandler(value, handlers) {
|
|
|
181
175
|
* Build base squel classes and methods
|
|
182
176
|
*/
|
|
183
177
|
function _buildSquel() {
|
|
184
|
-
var flavour = arguments.length
|
|
178
|
+
var flavour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
185
179
|
|
|
186
180
|
var cls = {
|
|
187
181
|
// Get whether obj is a query builder
|
|
@@ -287,11 +281,10 @@ function _buildSquel() {
|
|
|
287
281
|
* Constructor.
|
|
288
282
|
* this.param {Object} options Overriding one or more of `cls.DefaultQueryBuilderOptions`.
|
|
289
283
|
*/
|
|
290
|
-
|
|
291
284
|
function _class2(options) {
|
|
292
285
|
_classCallCheck(this, _class2);
|
|
293
286
|
|
|
294
|
-
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(_class2).call(this));
|
|
287
|
+
var _this = _possibleConstructorReturn(this, (_class2.__proto__ || Object.getPrototypeOf(_class2)).call(this));
|
|
295
288
|
|
|
296
289
|
var defaults = JSON.parse(JSON.stringify(cls.DefaultQueryBuilderOptions));
|
|
297
290
|
// for function values, etc we need to manually copy
|
|
@@ -418,16 +411,16 @@ function _buildSquel() {
|
|
|
418
411
|
if (null === item) {
|
|
419
412
|
// null is allowed
|
|
420
413
|
} else if ("string" === itemType || "number" === itemType || "boolean" === itemType) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
414
|
+
// primitives are allowed
|
|
415
|
+
} else if (cls.isSquelBuilder(item)) {
|
|
416
|
+
// Builders allowed
|
|
417
|
+
} else {
|
|
418
|
+
var typeIsValid = !!getValueHandler(item, this.options.valueHandlers, cls.globalValueHandlers);
|
|
426
419
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
420
|
+
if (!typeIsValid) {
|
|
421
|
+
throw new Error("field value must be a string, number, boolean, null or one of the registered custom value types");
|
|
422
|
+
}
|
|
423
|
+
}
|
|
431
424
|
|
|
432
425
|
return item;
|
|
433
426
|
}
|
|
@@ -437,7 +430,7 @@ function _buildSquel() {
|
|
|
437
430
|
}, {
|
|
438
431
|
key: '_escapeValue',
|
|
439
432
|
value: function _escapeValue(value) {
|
|
440
|
-
return
|
|
433
|
+
return this.options.replaceSingleQuotes && value ? value.replace(/\'/g, this.options.singleQuoteReplacement) : value;
|
|
441
434
|
}
|
|
442
435
|
}, {
|
|
443
436
|
key: '_formatTableName',
|
|
@@ -475,25 +468,21 @@ function _buildSquel() {
|
|
|
475
468
|
}, {
|
|
476
469
|
key: '_formatFieldName',
|
|
477
470
|
value: function _formatFieldName(item) {
|
|
478
|
-
var
|
|
479
|
-
|
|
480
|
-
var formattingOptions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
471
|
+
var formattingOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
481
472
|
|
|
482
473
|
if (this.options.autoQuoteFieldNames) {
|
|
483
|
-
|
|
484
|
-
var quoteChar = _this2.options.nameQuoteCharacter;
|
|
474
|
+
var quoteChar = this.options.nameQuoteCharacter;
|
|
485
475
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
})();
|
|
476
|
+
if (formattingOptions.ignorePeriodsForFieldNameQuotes) {
|
|
477
|
+
// a.b.c -> `a.b.c`
|
|
478
|
+
item = '' + quoteChar + item + quoteChar;
|
|
479
|
+
} else {
|
|
480
|
+
// a.b.c -> `a`.`b`.`c`
|
|
481
|
+
item = item.split('.').map(function (v) {
|
|
482
|
+
// treat '*' as special case (#79)
|
|
483
|
+
return '*' === v ? v : '' + quoteChar + v + quoteChar;
|
|
484
|
+
}).join('.');
|
|
485
|
+
}
|
|
497
486
|
}
|
|
498
487
|
|
|
499
488
|
return item;
|
|
@@ -535,13 +524,13 @@ function _buildSquel() {
|
|
|
535
524
|
}, {
|
|
536
525
|
key: '_formatValueForParamArray',
|
|
537
526
|
value: function _formatValueForParamArray(value) {
|
|
538
|
-
var
|
|
527
|
+
var _this2 = this;
|
|
539
528
|
|
|
540
|
-
var formattingOptions = arguments.length
|
|
529
|
+
var formattingOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
541
530
|
|
|
542
531
|
if (_isArray(value)) {
|
|
543
532
|
return value.map(function (v) {
|
|
544
|
-
return
|
|
533
|
+
return _this2._formatValueForParamArray(v, formattingOptions);
|
|
545
534
|
});
|
|
546
535
|
} else {
|
|
547
536
|
return this._formatCustomValue(value, true, formattingOptions).value;
|
|
@@ -555,20 +544,19 @@ function _buildSquel() {
|
|
|
555
544
|
}, {
|
|
556
545
|
key: '_formatValueForQueryString',
|
|
557
546
|
value: function _formatValueForQueryString(initialValue) {
|
|
558
|
-
var
|
|
547
|
+
var _this3 = this;
|
|
559
548
|
|
|
560
|
-
var formattingOptions = arguments.length
|
|
549
|
+
var formattingOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
561
550
|
|
|
562
551
|
// maybe we have a cusotm value handler
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var formatted = _formatCustomValue2.formatted;
|
|
568
|
-
var value = _formatCustomValue2.value;
|
|
552
|
+
var _formatCustomValue2 = this._formatCustomValue(initialValue, false, formattingOptions),
|
|
553
|
+
rawNesting = _formatCustomValue2.rawNesting,
|
|
554
|
+
formatted = _formatCustomValue2.formatted,
|
|
555
|
+
value = _formatCustomValue2.value;
|
|
569
556
|
|
|
570
557
|
// if formatting took place then return it directly
|
|
571
558
|
|
|
559
|
+
|
|
572
560
|
if (formatted) {
|
|
573
561
|
if (rawNesting) {
|
|
574
562
|
return value;
|
|
@@ -580,7 +568,7 @@ function _buildSquel() {
|
|
|
580
568
|
// if it's an array then format each element separately
|
|
581
569
|
if (_isArray(value)) {
|
|
582
570
|
value = value.map(function (v) {
|
|
583
|
-
return
|
|
571
|
+
return _this3._formatValueForQueryString(v);
|
|
584
572
|
});
|
|
585
573
|
|
|
586
574
|
value = this._applyNestingFormatting(value.join(', '), _shouldApplyNesting(value));
|
|
@@ -614,7 +602,7 @@ function _buildSquel() {
|
|
|
614
602
|
}, {
|
|
615
603
|
key: '_applyNestingFormatting',
|
|
616
604
|
value: function _applyNestingFormatting(str) {
|
|
617
|
-
var nesting = arguments.length
|
|
605
|
+
var nesting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
618
606
|
|
|
619
607
|
if (str && typeof str === 'string' && nesting && !this.options.rawNesting) {
|
|
620
608
|
// apply brackets if they're not already existing
|
|
@@ -665,10 +653,10 @@ function _buildSquel() {
|
|
|
665
653
|
}, {
|
|
666
654
|
key: '_buildString',
|
|
667
655
|
value: function _buildString(str, values) {
|
|
668
|
-
var options = arguments.length
|
|
669
|
-
var nested = options.nested
|
|
670
|
-
|
|
671
|
-
|
|
656
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
657
|
+
var nested = options.nested,
|
|
658
|
+
buildParameterized = options.buildParameterized,
|
|
659
|
+
formattingOptions = options.formattingOptions;
|
|
672
660
|
|
|
673
661
|
|
|
674
662
|
values = values || [];
|
|
@@ -751,7 +739,7 @@ function _buildSquel() {
|
|
|
751
739
|
}, {
|
|
752
740
|
key: '_buildManyStrings',
|
|
753
741
|
value: function _buildManyStrings(strings, strValues) {
|
|
754
|
-
var options = arguments.length
|
|
742
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
755
743
|
|
|
756
744
|
var totalStr = [],
|
|
757
745
|
totalValues = [];
|
|
@@ -763,11 +751,9 @@ function _buildSquel() {
|
|
|
763
751
|
var _buildString2 = this._buildString(inputString, inputValues, {
|
|
764
752
|
buildParameterized: options.buildParameterized,
|
|
765
753
|
nested: false
|
|
766
|
-
})
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
var values = _buildString2.values;
|
|
770
|
-
|
|
754
|
+
}),
|
|
755
|
+
text = _buildString2.text,
|
|
756
|
+
values = _buildString2.values;
|
|
771
757
|
|
|
772
758
|
totalStr.push(text);
|
|
773
759
|
values.forEach(function (value) {
|
|
@@ -806,7 +792,7 @@ function _buildSquel() {
|
|
|
806
792
|
}, {
|
|
807
793
|
key: 'toString',
|
|
808
794
|
value: function toString() {
|
|
809
|
-
var options = arguments.length
|
|
795
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
810
796
|
|
|
811
797
|
return this._toParamString(options).text;
|
|
812
798
|
}
|
|
@@ -819,7 +805,7 @@ function _buildSquel() {
|
|
|
819
805
|
}, {
|
|
820
806
|
key: 'toParam',
|
|
821
807
|
value: function toParam() {
|
|
822
|
-
var options = arguments.length
|
|
808
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
823
809
|
|
|
824
810
|
return this._toParamString(_extend({}, options, {
|
|
825
811
|
buildParameterized: true
|
|
@@ -853,14 +839,13 @@ function _buildSquel() {
|
|
|
853
839
|
_inherits(_class3, _cls$BaseBuilder);
|
|
854
840
|
|
|
855
841
|
// Initialise the expression.
|
|
856
|
-
|
|
857
842
|
function _class3(options) {
|
|
858
843
|
_classCallCheck(this, _class3);
|
|
859
844
|
|
|
860
|
-
var
|
|
845
|
+
var _this4 = _possibleConstructorReturn(this, (_class3.__proto__ || Object.getPrototypeOf(_class3)).call(this, options));
|
|
861
846
|
|
|
862
|
-
|
|
863
|
-
return
|
|
847
|
+
_this4._nodes = [];
|
|
848
|
+
return _this4;
|
|
864
849
|
}
|
|
865
850
|
|
|
866
851
|
// Combine the current expression with the given expression using the intersection operator (AND).
|
|
@@ -906,7 +891,7 @@ function _buildSquel() {
|
|
|
906
891
|
}, {
|
|
907
892
|
key: '_toParamString',
|
|
908
893
|
value: function _toParamString() {
|
|
909
|
-
var options = arguments.length
|
|
894
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
910
895
|
|
|
911
896
|
var totalStr = [],
|
|
912
897
|
totalValues = [];
|
|
@@ -918,20 +903,18 @@ function _buildSquel() {
|
|
|
918
903
|
try {
|
|
919
904
|
for (var _iterator3 = this._nodes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
920
905
|
var node = _step3.value;
|
|
921
|
-
var type = node.type
|
|
922
|
-
|
|
923
|
-
|
|
906
|
+
var type = node.type,
|
|
907
|
+
expr = node.expr,
|
|
908
|
+
para = node.para;
|
|
924
909
|
|
|
925
910
|
var _ref = cls.isSquelBuilder(expr) ? expr._toParamString({
|
|
926
911
|
buildParameterized: options.buildParameterized,
|
|
927
912
|
nested: true
|
|
928
913
|
}) : this._buildString(expr, para, {
|
|
929
914
|
buildParameterized: options.buildParameterized
|
|
930
|
-
})
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
var values = _ref.values;
|
|
934
|
-
|
|
915
|
+
}),
|
|
916
|
+
text = _ref.text,
|
|
917
|
+
values = _ref.values;
|
|
935
918
|
|
|
936
919
|
if (totalStr.length) {
|
|
937
920
|
totalStr.push(type);
|
|
@@ -986,11 +969,11 @@ function _buildSquel() {
|
|
|
986
969
|
_inherits(_class4, _cls$BaseBuilder2);
|
|
987
970
|
|
|
988
971
|
function _class4(fieldName) {
|
|
989
|
-
var options = arguments.length
|
|
972
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
990
973
|
|
|
991
974
|
_classCallCheck(this, _class4);
|
|
992
975
|
|
|
993
|
-
var
|
|
976
|
+
var _this5 = _possibleConstructorReturn(this, (_class4.__proto__ || Object.getPrototypeOf(_class4)).call(this, options));
|
|
994
977
|
|
|
995
978
|
if (_isPlainObject(fieldName)) {
|
|
996
979
|
options = fieldName;
|
|
@@ -999,14 +982,14 @@ function _buildSquel() {
|
|
|
999
982
|
}
|
|
1000
983
|
|
|
1001
984
|
if (fieldName) {
|
|
1002
|
-
|
|
985
|
+
_this5._fieldName = _this5._sanitizeField(fieldName);
|
|
1003
986
|
}
|
|
1004
987
|
|
|
1005
|
-
|
|
988
|
+
_this5.options = _extend({}, cls.DefaultQueryBuilderOptions, options);
|
|
1006
989
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
return
|
|
990
|
+
_this5._cases = [];
|
|
991
|
+
_this5._elseValue = null;
|
|
992
|
+
return _this5;
|
|
1010
993
|
}
|
|
1011
994
|
|
|
1012
995
|
_createClass(_class4, [{
|
|
@@ -1044,7 +1027,7 @@ function _buildSquel() {
|
|
|
1044
1027
|
}, {
|
|
1045
1028
|
key: '_toParamString',
|
|
1046
1029
|
value: function _toParamString() {
|
|
1047
|
-
var options = arguments.length
|
|
1030
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1048
1031
|
|
|
1049
1032
|
var totalStr = '',
|
|
1050
1033
|
totalValues = [];
|
|
@@ -1055,10 +1038,10 @@ function _buildSquel() {
|
|
|
1055
1038
|
|
|
1056
1039
|
try {
|
|
1057
1040
|
for (var _iterator4 = this._cases[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
1058
|
-
var
|
|
1059
|
-
var expression =
|
|
1060
|
-
var _values =
|
|
1061
|
-
var result =
|
|
1041
|
+
var _ref2 = _step4.value;
|
|
1042
|
+
var expression = _ref2.expression;
|
|
1043
|
+
var _values = _ref2.values;
|
|
1044
|
+
var result = _ref2.result;
|
|
1062
1045
|
|
|
1063
1046
|
totalStr = _pad(totalStr, ' ');
|
|
1064
1047
|
|
|
@@ -1135,7 +1118,7 @@ function _buildSquel() {
|
|
|
1135
1118
|
function _class5(options) {
|
|
1136
1119
|
_classCallCheck(this, _class5);
|
|
1137
1120
|
|
|
1138
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class5).call(this, options));
|
|
1121
|
+
return _possibleConstructorReturn(this, (_class5.__proto__ || Object.getPrototypeOf(_class5)).call(this, options));
|
|
1139
1122
|
}
|
|
1140
1123
|
|
|
1141
1124
|
/**
|
|
@@ -1180,16 +1163,16 @@ function _buildSquel() {
|
|
|
1180
1163
|
function _class6(options, str) {
|
|
1181
1164
|
_classCallCheck(this, _class6);
|
|
1182
1165
|
|
|
1183
|
-
var
|
|
1166
|
+
var _this7 = _possibleConstructorReturn(this, (_class6.__proto__ || Object.getPrototypeOf(_class6)).call(this, options));
|
|
1184
1167
|
|
|
1185
|
-
|
|
1186
|
-
return
|
|
1168
|
+
_this7._str = str;
|
|
1169
|
+
return _this7;
|
|
1187
1170
|
}
|
|
1188
1171
|
|
|
1189
1172
|
_createClass(_class6, [{
|
|
1190
1173
|
key: '_toParamString',
|
|
1191
1174
|
value: function _toParamString() {
|
|
1192
|
-
var options = arguments.length
|
|
1175
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1193
1176
|
|
|
1194
1177
|
return {
|
|
1195
1178
|
text: this._str,
|
|
@@ -1208,11 +1191,11 @@ function _buildSquel() {
|
|
|
1208
1191
|
function _class7(options) {
|
|
1209
1192
|
_classCallCheck(this, _class7);
|
|
1210
1193
|
|
|
1211
|
-
var
|
|
1194
|
+
var _this8 = _possibleConstructorReturn(this, (_class7.__proto__ || Object.getPrototypeOf(_class7)).call(this, options));
|
|
1212
1195
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
return
|
|
1196
|
+
_this8._strings = [];
|
|
1197
|
+
_this8._values = [];
|
|
1198
|
+
return _this8;
|
|
1216
1199
|
}
|
|
1217
1200
|
|
|
1218
1201
|
_createClass(_class7, [{
|
|
@@ -1229,7 +1212,7 @@ function _buildSquel() {
|
|
|
1229
1212
|
}, {
|
|
1230
1213
|
key: '_toParamString',
|
|
1231
1214
|
value: function _toParamString() {
|
|
1232
|
-
var options = arguments.length
|
|
1215
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1233
1216
|
|
|
1234
1217
|
return this._buildManyStrings(this._strings, this._values, options);
|
|
1235
1218
|
}
|
|
@@ -1240,7 +1223,7 @@ function _buildSquel() {
|
|
|
1240
1223
|
|
|
1241
1224
|
// value handler for FunctionValueBlock objects
|
|
1242
1225
|
cls.registerValueHandler(cls.FunctionBlock, function (value) {
|
|
1243
|
-
var asParam = arguments.length
|
|
1226
|
+
var asParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1244
1227
|
|
|
1245
1228
|
return asParam ? value.toParam() : value.toString();
|
|
1246
1229
|
});
|
|
@@ -1255,14 +1238,13 @@ function _buildSquel() {
|
|
|
1255
1238
|
* @param {Boolean} [options.singleTable] If true then only allow one table spec.
|
|
1256
1239
|
* @param {String} [options.prefix] String prefix for output.
|
|
1257
1240
|
*/
|
|
1258
|
-
|
|
1259
1241
|
function _class8(options, prefix) {
|
|
1260
1242
|
_classCallCheck(this, _class8);
|
|
1261
1243
|
|
|
1262
|
-
var
|
|
1244
|
+
var _this9 = _possibleConstructorReturn(this, (_class8.__proto__ || Object.getPrototypeOf(_class8)).call(this, options));
|
|
1263
1245
|
|
|
1264
|
-
|
|
1265
|
-
return
|
|
1246
|
+
_this9._tables = [];
|
|
1247
|
+
return _this9;
|
|
1266
1248
|
}
|
|
1267
1249
|
|
|
1268
1250
|
/**
|
|
@@ -1277,7 +1259,7 @@ function _buildSquel() {
|
|
|
1277
1259
|
_createClass(_class8, [{
|
|
1278
1260
|
key: '_table',
|
|
1279
1261
|
value: function _table(table) {
|
|
1280
|
-
var alias = arguments.length
|
|
1262
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1281
1263
|
|
|
1282
1264
|
alias = alias ? this._sanitizeTableAlias(alias) : alias;
|
|
1283
1265
|
table = this._sanitizeTable(table);
|
|
@@ -1307,7 +1289,7 @@ function _buildSquel() {
|
|
|
1307
1289
|
}, {
|
|
1308
1290
|
key: '_toParamString',
|
|
1309
1291
|
value: function _toParamString() {
|
|
1310
|
-
var options = arguments.length
|
|
1292
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1311
1293
|
|
|
1312
1294
|
var totalStr = '',
|
|
1313
1295
|
totalValues = [];
|
|
@@ -1320,9 +1302,9 @@ function _buildSquel() {
|
|
|
1320
1302
|
|
|
1321
1303
|
try {
|
|
1322
1304
|
for (var _iterator5 = this._tables[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
1323
|
-
var
|
|
1324
|
-
var table =
|
|
1325
|
-
var alias =
|
|
1305
|
+
var _ref3 = _step5.value;
|
|
1306
|
+
var table = _ref3.table;
|
|
1307
|
+
var alias = _ref3.alias;
|
|
1326
1308
|
|
|
1327
1309
|
totalStr = _pad(totalStr, ', ');
|
|
1328
1310
|
|
|
@@ -1332,11 +1314,9 @@ function _buildSquel() {
|
|
|
1332
1314
|
var _table$_toParamString = table._toParamString({
|
|
1333
1315
|
buildParameterized: options.buildParameterized,
|
|
1334
1316
|
nested: true
|
|
1335
|
-
})
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
var values = _table$_toParamString.values;
|
|
1339
|
-
|
|
1317
|
+
}),
|
|
1318
|
+
text = _table$_toParamString.text,
|
|
1319
|
+
values = _table$_toParamString.values;
|
|
1340
1320
|
|
|
1341
1321
|
tableStr = text;
|
|
1342
1322
|
values.forEach(function (value) {
|
|
@@ -1389,7 +1369,7 @@ function _buildSquel() {
|
|
|
1389
1369
|
function _class9() {
|
|
1390
1370
|
_classCallCheck(this, _class9);
|
|
1391
1371
|
|
|
1392
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class9).apply(this, arguments));
|
|
1372
|
+
return _possibleConstructorReturn(this, (_class9.__proto__ || Object.getPrototypeOf(_class9)).apply(this, arguments));
|
|
1393
1373
|
}
|
|
1394
1374
|
|
|
1395
1375
|
_createClass(_class9, [{
|
|
@@ -1409,26 +1389,26 @@ function _buildSquel() {
|
|
|
1409
1389
|
function _class10() {
|
|
1410
1390
|
_classCallCheck(this, _class10);
|
|
1411
1391
|
|
|
1412
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class10).apply(this, arguments));
|
|
1392
|
+
return _possibleConstructorReturn(this, (_class10.__proto__ || Object.getPrototypeOf(_class10)).apply(this, arguments));
|
|
1413
1393
|
}
|
|
1414
1394
|
|
|
1415
1395
|
_createClass(_class10, [{
|
|
1416
1396
|
key: 'table',
|
|
1417
1397
|
value: function table(_table2) {
|
|
1418
|
-
var alias = arguments.length
|
|
1398
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1419
1399
|
|
|
1420
1400
|
this._table(_table2, alias);
|
|
1421
1401
|
}
|
|
1422
1402
|
}, {
|
|
1423
1403
|
key: '_toParamString',
|
|
1424
1404
|
value: function _toParamString() {
|
|
1425
|
-
var options = arguments.length
|
|
1405
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1426
1406
|
|
|
1427
1407
|
if (!this._hasTable()) {
|
|
1428
1408
|
throw new Error("table() needs to be called");
|
|
1429
1409
|
}
|
|
1430
1410
|
|
|
1431
|
-
return _get(Object.getPrototypeOf(_class10.prototype), '_toParamString', this).call(this, options);
|
|
1411
|
+
return _get(_class10.prototype.__proto__ || Object.getPrototypeOf(_class10.prototype), '_toParamString', this).call(this, options);
|
|
1432
1412
|
}
|
|
1433
1413
|
}]);
|
|
1434
1414
|
|
|
@@ -1442,7 +1422,7 @@ function _buildSquel() {
|
|
|
1442
1422
|
function _class11(options) {
|
|
1443
1423
|
_classCallCheck(this, _class11);
|
|
1444
1424
|
|
|
1445
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class11).call(this, _extend({}, options, {
|
|
1425
|
+
return _possibleConstructorReturn(this, (_class11.__proto__ || Object.getPrototypeOf(_class11)).call(this, _extend({}, options, {
|
|
1446
1426
|
prefix: 'FROM'
|
|
1447
1427
|
})));
|
|
1448
1428
|
}
|
|
@@ -1450,7 +1430,7 @@ function _buildSquel() {
|
|
|
1450
1430
|
_createClass(_class11, [{
|
|
1451
1431
|
key: 'from',
|
|
1452
1432
|
value: function from(table) {
|
|
1453
|
-
var alias = arguments.length
|
|
1433
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1454
1434
|
|
|
1455
1435
|
this._table(table, alias);
|
|
1456
1436
|
}
|
|
@@ -1466,7 +1446,7 @@ function _buildSquel() {
|
|
|
1466
1446
|
function _class12(options) {
|
|
1467
1447
|
_classCallCheck(this, _class12);
|
|
1468
1448
|
|
|
1469
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class12).call(this, _extend({}, options, {
|
|
1449
|
+
return _possibleConstructorReturn(this, (_class12.__proto__ || Object.getPrototypeOf(_class12)).call(this, _extend({}, options, {
|
|
1470
1450
|
prefix: 'INTO',
|
|
1471
1451
|
singleTable: true
|
|
1472
1452
|
})));
|
|
@@ -1480,13 +1460,13 @@ function _buildSquel() {
|
|
|
1480
1460
|
}, {
|
|
1481
1461
|
key: '_toParamString',
|
|
1482
1462
|
value: function _toParamString() {
|
|
1483
|
-
var options = arguments.length
|
|
1463
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1484
1464
|
|
|
1485
1465
|
if (!this._hasTable()) {
|
|
1486
1466
|
throw new Error("into() needs to be called");
|
|
1487
1467
|
}
|
|
1488
1468
|
|
|
1489
|
-
return _get(Object.getPrototypeOf(_class12.prototype), '_toParamString', this).call(this, options);
|
|
1469
|
+
return _get(_class12.prototype.__proto__ || Object.getPrototypeOf(_class12.prototype), '_toParamString', this).call(this, options);
|
|
1490
1470
|
}
|
|
1491
1471
|
}]);
|
|
1492
1472
|
|
|
@@ -1500,10 +1480,10 @@ function _buildSquel() {
|
|
|
1500
1480
|
function _class13(options) {
|
|
1501
1481
|
_classCallCheck(this, _class13);
|
|
1502
1482
|
|
|
1503
|
-
var
|
|
1483
|
+
var _this14 = _possibleConstructorReturn(this, (_class13.__proto__ || Object.getPrototypeOf(_class13)).call(this, options));
|
|
1504
1484
|
|
|
1505
|
-
|
|
1506
|
-
return
|
|
1485
|
+
_this14._fields = [];
|
|
1486
|
+
return _this14;
|
|
1507
1487
|
}
|
|
1508
1488
|
|
|
1509
1489
|
/**
|
|
@@ -1521,7 +1501,7 @@ function _buildSquel() {
|
|
|
1521
1501
|
_createClass(_class13, [{
|
|
1522
1502
|
key: 'fields',
|
|
1523
1503
|
value: function fields(_fields) {
|
|
1524
|
-
var options = arguments.length
|
|
1504
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1525
1505
|
|
|
1526
1506
|
if (_isArray(_fields)) {
|
|
1527
1507
|
var _iteratorNormalCompletion6 = true;
|
|
@@ -1571,8 +1551,8 @@ function _buildSquel() {
|
|
|
1571
1551
|
}, {
|
|
1572
1552
|
key: 'field',
|
|
1573
1553
|
value: function field(_field) {
|
|
1574
|
-
var alias = arguments.length
|
|
1575
|
-
var options = arguments.length
|
|
1554
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1555
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1576
1556
|
|
|
1577
1557
|
alias = alias ? this._sanitizeFieldAlias(alias) : alias;
|
|
1578
1558
|
_field = this._sanitizeField(_field);
|
|
@@ -1594,9 +1574,9 @@ function _buildSquel() {
|
|
|
1594
1574
|
}, {
|
|
1595
1575
|
key: '_toParamString',
|
|
1596
1576
|
value: function _toParamString() {
|
|
1597
|
-
var options = arguments.length
|
|
1598
|
-
var queryBuilder = options.queryBuilder
|
|
1599
|
-
|
|
1577
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1578
|
+
var queryBuilder = options.queryBuilder,
|
|
1579
|
+
buildParameterized = options.buildParameterized;
|
|
1600
1580
|
|
|
1601
1581
|
|
|
1602
1582
|
var totalStr = '',
|
|
@@ -1612,9 +1592,9 @@ function _buildSquel() {
|
|
|
1612
1592
|
|
|
1613
1593
|
totalStr = _pad(totalStr, ", ");
|
|
1614
1594
|
|
|
1615
|
-
var name = field.name
|
|
1616
|
-
|
|
1617
|
-
|
|
1595
|
+
var name = field.name,
|
|
1596
|
+
alias = field.alias,
|
|
1597
|
+
_options = field.options;
|
|
1618
1598
|
|
|
1619
1599
|
|
|
1620
1600
|
if (typeof name === 'string') {
|
|
@@ -1675,10 +1655,10 @@ function _buildSquel() {
|
|
|
1675
1655
|
function _class14(options) {
|
|
1676
1656
|
_classCallCheck(this, _class14);
|
|
1677
1657
|
|
|
1678
|
-
var
|
|
1658
|
+
var _this15 = _possibleConstructorReturn(this, (_class14.__proto__ || Object.getPrototypeOf(_class14)).call(this, options));
|
|
1679
1659
|
|
|
1680
|
-
|
|
1681
|
-
return
|
|
1660
|
+
_this15._reset();
|
|
1661
|
+
return _this15;
|
|
1682
1662
|
}
|
|
1683
1663
|
|
|
1684
1664
|
_createClass(_class14, [{
|
|
@@ -1695,7 +1675,7 @@ function _buildSquel() {
|
|
|
1695
1675
|
}, {
|
|
1696
1676
|
key: '_set',
|
|
1697
1677
|
value: function _set(field, value) {
|
|
1698
|
-
var valueOptions = arguments.length
|
|
1678
|
+
var valueOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1699
1679
|
|
|
1700
1680
|
if (this._values.length > 1) {
|
|
1701
1681
|
throw new Error("Cannot set multiple rows of fields this way.");
|
|
@@ -1725,7 +1705,7 @@ function _buildSquel() {
|
|
|
1725
1705
|
}, {
|
|
1726
1706
|
key: '_setFields',
|
|
1727
1707
|
value: function _setFields(fields) {
|
|
1728
|
-
var valueOptions = arguments.length
|
|
1708
|
+
var valueOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1729
1709
|
|
|
1730
1710
|
if ((typeof fields === 'undefined' ? 'undefined' : _typeof(fields)) !== 'object') {
|
|
1731
1711
|
throw new Error("Expected an object but got " + (typeof fields === 'undefined' ? 'undefined' : _typeof(fields)));
|
|
@@ -1742,7 +1722,7 @@ function _buildSquel() {
|
|
|
1742
1722
|
}, {
|
|
1743
1723
|
key: '_setFieldsRows',
|
|
1744
1724
|
value: function _setFieldsRows(fieldsRows) {
|
|
1745
|
-
var valueOptions = arguments.length
|
|
1725
|
+
var valueOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1746
1726
|
|
|
1747
1727
|
if (!_isArray(fieldsRows)) {
|
|
1748
1728
|
throw new Error("Expected an array of objects but got " + (typeof fieldsRows === 'undefined' ? 'undefined' : _typeof(fieldsRows)));
|
|
@@ -1797,7 +1777,7 @@ function _buildSquel() {
|
|
|
1797
1777
|
function _class15() {
|
|
1798
1778
|
_classCallCheck(this, _class15);
|
|
1799
1779
|
|
|
1800
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class15).apply(this, arguments));
|
|
1780
|
+
return _possibleConstructorReturn(this, (_class15.__proto__ || Object.getPrototypeOf(_class15)).apply(this, arguments));
|
|
1801
1781
|
}
|
|
1802
1782
|
|
|
1803
1783
|
_createClass(_class15, [{
|
|
@@ -1813,7 +1793,7 @@ function _buildSquel() {
|
|
|
1813
1793
|
}, {
|
|
1814
1794
|
key: '_toParamString',
|
|
1815
1795
|
value: function _toParamString() {
|
|
1816
|
-
var options = arguments.length
|
|
1796
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1817
1797
|
var buildParameterized = options.buildParameterized;
|
|
1818
1798
|
|
|
1819
1799
|
|
|
@@ -1863,13 +1843,13 @@ function _buildSquel() {
|
|
|
1863
1843
|
function _class16() {
|
|
1864
1844
|
_classCallCheck(this, _class16);
|
|
1865
1845
|
|
|
1866
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class16).apply(this, arguments));
|
|
1846
|
+
return _possibleConstructorReturn(this, (_class16.__proto__ || Object.getPrototypeOf(_class16)).apply(this, arguments));
|
|
1867
1847
|
}
|
|
1868
1848
|
|
|
1869
1849
|
_createClass(_class16, [{
|
|
1870
1850
|
key: 'set',
|
|
1871
1851
|
value: function set(field, value) {
|
|
1872
|
-
var options = arguments.length
|
|
1852
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1873
1853
|
|
|
1874
1854
|
this._set(field, value, options);
|
|
1875
1855
|
}
|
|
@@ -1886,14 +1866,14 @@ function _buildSquel() {
|
|
|
1886
1866
|
}, {
|
|
1887
1867
|
key: '_toParamString',
|
|
1888
1868
|
value: function _toParamString() {
|
|
1889
|
-
var
|
|
1869
|
+
var _this18 = this;
|
|
1890
1870
|
|
|
1891
|
-
var options = arguments.length
|
|
1871
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1892
1872
|
var buildParameterized = options.buildParameterized;
|
|
1893
1873
|
|
|
1894
1874
|
|
|
1895
1875
|
var fieldString = this._fields.map(function (f) {
|
|
1896
|
-
return
|
|
1876
|
+
return _this18._formatFieldName(f);
|
|
1897
1877
|
}).join(', ');
|
|
1898
1878
|
|
|
1899
1879
|
var valueStrings = [],
|
|
@@ -1934,20 +1914,20 @@ function _buildSquel() {
|
|
|
1934
1914
|
function _class17(options) {
|
|
1935
1915
|
_classCallCheck(this, _class17);
|
|
1936
1916
|
|
|
1937
|
-
var
|
|
1917
|
+
var _this19 = _possibleConstructorReturn(this, (_class17.__proto__ || Object.getPrototypeOf(_class17)).call(this, options));
|
|
1938
1918
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
return
|
|
1919
|
+
_this19._fields = [];
|
|
1920
|
+
_this19._query = null;
|
|
1921
|
+
return _this19;
|
|
1942
1922
|
}
|
|
1943
1923
|
|
|
1944
1924
|
_createClass(_class17, [{
|
|
1945
1925
|
key: 'fromQuery',
|
|
1946
1926
|
value: function fromQuery(fields, selectQuery) {
|
|
1947
|
-
var
|
|
1927
|
+
var _this20 = this;
|
|
1948
1928
|
|
|
1949
1929
|
this._fields = fields.map(function (v) {
|
|
1950
|
-
return
|
|
1930
|
+
return _this20._sanitizeField(v);
|
|
1951
1931
|
});
|
|
1952
1932
|
|
|
1953
1933
|
this._query = this._sanitizeBaseBuilder(selectQuery);
|
|
@@ -1955,7 +1935,7 @@ function _buildSquel() {
|
|
|
1955
1935
|
}, {
|
|
1956
1936
|
key: '_toParamString',
|
|
1957
1937
|
value: function _toParamString() {
|
|
1958
|
-
var options = arguments.length
|
|
1938
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1959
1939
|
|
|
1960
1940
|
var totalStr = '',
|
|
1961
1941
|
totalValues = [];
|
|
@@ -1964,11 +1944,9 @@ function _buildSquel() {
|
|
|
1964
1944
|
var _query$_toParamString = this._query._toParamString({
|
|
1965
1945
|
buildParameterized: options.buildParameterized,
|
|
1966
1946
|
nested: true
|
|
1967
|
-
})
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
var values = _query$_toParamString.values;
|
|
1971
|
-
|
|
1947
|
+
}),
|
|
1948
|
+
text = _query$_toParamString.text,
|
|
1949
|
+
values = _query$_toParamString.values;
|
|
1972
1950
|
|
|
1973
1951
|
totalStr = '(' + this._fields.join(', ') + ') ' + this._applyNestingFormatting(text);
|
|
1974
1952
|
totalValues = values;
|
|
@@ -1991,7 +1969,7 @@ function _buildSquel() {
|
|
|
1991
1969
|
function _class18() {
|
|
1992
1970
|
_classCallCheck(this, _class18);
|
|
1993
1971
|
|
|
1994
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class18).apply(this, arguments));
|
|
1972
|
+
return _possibleConstructorReturn(this, (_class18.__proto__ || Object.getPrototypeOf(_class18)).apply(this, arguments));
|
|
1995
1973
|
}
|
|
1996
1974
|
|
|
1997
1975
|
_createClass(_class18, [{
|
|
@@ -2021,10 +1999,10 @@ function _buildSquel() {
|
|
|
2021
1999
|
function _class19(options) {
|
|
2022
2000
|
_classCallCheck(this, _class19);
|
|
2023
2001
|
|
|
2024
|
-
var
|
|
2002
|
+
var _this22 = _possibleConstructorReturn(this, (_class19.__proto__ || Object.getPrototypeOf(_class19)).call(this, options));
|
|
2025
2003
|
|
|
2026
|
-
|
|
2027
|
-
return
|
|
2004
|
+
_this22._groups = [];
|
|
2005
|
+
return _this22;
|
|
2028
2006
|
}
|
|
2029
2007
|
|
|
2030
2008
|
// Add a GROUP BY transformation for the given field.
|
|
@@ -2038,7 +2016,7 @@ function _buildSquel() {
|
|
|
2038
2016
|
}, {
|
|
2039
2017
|
key: '_toParamString',
|
|
2040
2018
|
value: function _toParamString() {
|
|
2041
|
-
var options = arguments.length
|
|
2019
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2042
2020
|
|
|
2043
2021
|
return {
|
|
2044
2022
|
text: this._groups.length ? 'GROUP BY ' + this._groups.join(', ') : '',
|
|
@@ -2056,25 +2034,24 @@ function _buildSquel() {
|
|
|
2056
2034
|
/**
|
|
2057
2035
|
* @param options.verb The prefix verb string.
|
|
2058
2036
|
*/
|
|
2059
|
-
|
|
2060
2037
|
function _class20(options) {
|
|
2061
2038
|
_classCallCheck(this, _class20);
|
|
2062
2039
|
|
|
2063
|
-
var
|
|
2040
|
+
var _this23 = _possibleConstructorReturn(this, (_class20.__proto__ || Object.getPrototypeOf(_class20)).call(this, options));
|
|
2064
2041
|
|
|
2065
|
-
|
|
2066
|
-
return
|
|
2042
|
+
_this23._value = null;
|
|
2043
|
+
return _this23;
|
|
2067
2044
|
}
|
|
2068
2045
|
|
|
2069
2046
|
_createClass(_class20, [{
|
|
2070
2047
|
key: '_setValue',
|
|
2071
2048
|
value: function _setValue(value) {
|
|
2072
|
-
this._value = this._sanitizeLimitOffset(value);
|
|
2049
|
+
this._value = null !== value ? this._sanitizeLimitOffset(value) : value;
|
|
2073
2050
|
}
|
|
2074
2051
|
}, {
|
|
2075
2052
|
key: '_toParamString',
|
|
2076
2053
|
value: function _toParamString() {
|
|
2077
|
-
var options = arguments.length
|
|
2054
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2078
2055
|
|
|
2079
2056
|
var expr = null !== this._value ? this.options.verb + ' ' + this.options.parameterCharacter : '';
|
|
2080
2057
|
|
|
@@ -2094,7 +2071,7 @@ function _buildSquel() {
|
|
|
2094
2071
|
function _class21(options) {
|
|
2095
2072
|
_classCallCheck(this, _class21);
|
|
2096
2073
|
|
|
2097
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class21).call(this, _extend({}, options, {
|
|
2074
|
+
return _possibleConstructorReturn(this, (_class21.__proto__ || Object.getPrototypeOf(_class21)).call(this, _extend({}, options, {
|
|
2098
2075
|
verb: 'OFFSET'
|
|
2099
2076
|
})));
|
|
2100
2077
|
}
|
|
@@ -2124,7 +2101,7 @@ function _buildSquel() {
|
|
|
2124
2101
|
function _class22(options) {
|
|
2125
2102
|
_classCallCheck(this, _class22);
|
|
2126
2103
|
|
|
2127
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class22).call(this, _extend({}, options, {
|
|
2104
|
+
return _possibleConstructorReturn(this, (_class22.__proto__ || Object.getPrototypeOf(_class22)).call(this, _extend({}, options, {
|
|
2128
2105
|
verb: 'LIMIT'
|
|
2129
2106
|
})));
|
|
2130
2107
|
}
|
|
@@ -2132,7 +2109,7 @@ function _buildSquel() {
|
|
|
2132
2109
|
/**
|
|
2133
2110
|
# Set the LIMIT transformation.
|
|
2134
2111
|
#
|
|
2135
|
-
# Call this will override the previously set limit for this query. Also note that Passing
|
|
2112
|
+
# Call this will override the previously set limit for this query. Also note that Passing `null` will remove
|
|
2136
2113
|
# the limit.
|
|
2137
2114
|
*/
|
|
2138
2115
|
|
|
@@ -2154,14 +2131,13 @@ function _buildSquel() {
|
|
|
2154
2131
|
/**
|
|
2155
2132
|
* @param {String} options.verb The condition verb.
|
|
2156
2133
|
*/
|
|
2157
|
-
|
|
2158
2134
|
function _class23(options) {
|
|
2159
2135
|
_classCallCheck(this, _class23);
|
|
2160
2136
|
|
|
2161
|
-
var
|
|
2137
|
+
var _this26 = _possibleConstructorReturn(this, (_class23.__proto__ || Object.getPrototypeOf(_class23)).call(this, options));
|
|
2162
2138
|
|
|
2163
|
-
|
|
2164
|
-
return
|
|
2139
|
+
_this26._conditions = [];
|
|
2140
|
+
return _this26;
|
|
2165
2141
|
}
|
|
2166
2142
|
|
|
2167
2143
|
/**
|
|
@@ -2190,7 +2166,7 @@ function _buildSquel() {
|
|
|
2190
2166
|
}, {
|
|
2191
2167
|
key: '_toParamString',
|
|
2192
2168
|
value: function _toParamString() {
|
|
2193
|
-
var options = arguments.length
|
|
2169
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2194
2170
|
|
|
2195
2171
|
var totalStr = [],
|
|
2196
2172
|
totalValues = [];
|
|
@@ -2201,9 +2177,9 @@ function _buildSquel() {
|
|
|
2201
2177
|
|
|
2202
2178
|
try {
|
|
2203
2179
|
for (var _iterator8 = this._conditions[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
|
2204
|
-
var
|
|
2205
|
-
var expr =
|
|
2206
|
-
var _values2 =
|
|
2180
|
+
var _ref4 = _step8.value;
|
|
2181
|
+
var expr = _ref4.expr;
|
|
2182
|
+
var _values2 = _ref4.values;
|
|
2207
2183
|
|
|
2208
2184
|
var ret = cls.isSquelBuilder(expr) ? expr._toParamString({
|
|
2209
2185
|
buildParameterized: options.buildParameterized
|
|
@@ -2255,7 +2231,7 @@ function _buildSquel() {
|
|
|
2255
2231
|
function _class24(options) {
|
|
2256
2232
|
_classCallCheck(this, _class24);
|
|
2257
2233
|
|
|
2258
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class24).call(this, _extend({}, options, {
|
|
2234
|
+
return _possibleConstructorReturn(this, (_class24.__proto__ || Object.getPrototypeOf(_class24)).call(this, _extend({}, options, {
|
|
2259
2235
|
verb: 'WHERE'
|
|
2260
2236
|
})));
|
|
2261
2237
|
}
|
|
@@ -2281,7 +2257,7 @@ function _buildSquel() {
|
|
|
2281
2257
|
function _class25(options) {
|
|
2282
2258
|
_classCallCheck(this, _class25);
|
|
2283
2259
|
|
|
2284
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class25).call(this, _extend({}, options, {
|
|
2260
|
+
return _possibleConstructorReturn(this, (_class25.__proto__ || Object.getPrototypeOf(_class25)).call(this, _extend({}, options, {
|
|
2285
2261
|
verb: 'HAVING'
|
|
2286
2262
|
})));
|
|
2287
2263
|
}
|
|
@@ -2307,10 +2283,10 @@ function _buildSquel() {
|
|
|
2307
2283
|
function _class26(options) {
|
|
2308
2284
|
_classCallCheck(this, _class26);
|
|
2309
2285
|
|
|
2310
|
-
var
|
|
2286
|
+
var _this29 = _possibleConstructorReturn(this, (_class26.__proto__ || Object.getPrototypeOf(_class26)).call(this, options));
|
|
2311
2287
|
|
|
2312
|
-
|
|
2313
|
-
return
|
|
2288
|
+
_this29._orders = [];
|
|
2289
|
+
return _this29;
|
|
2314
2290
|
}
|
|
2315
2291
|
|
|
2316
2292
|
/**
|
|
@@ -2329,8 +2305,8 @@ function _buildSquel() {
|
|
|
2329
2305
|
if (dir === undefined) {
|
|
2330
2306
|
dir = 'ASC'; // Default to asc
|
|
2331
2307
|
} else if (dir !== null) {
|
|
2332
|
-
|
|
2333
|
-
|
|
2308
|
+
dir = dir ? 'ASC' : 'DESC'; // Convert truthy to asc
|
|
2309
|
+
}
|
|
2334
2310
|
}
|
|
2335
2311
|
|
|
2336
2312
|
for (var _len9 = arguments.length, values = Array(_len9 > 2 ? _len9 - 2 : 0), _key9 = 2; _key9 < _len9; _key9++) {
|
|
@@ -2346,7 +2322,7 @@ function _buildSquel() {
|
|
|
2346
2322
|
}, {
|
|
2347
2323
|
key: '_toParamString',
|
|
2348
2324
|
value: function _toParamString() {
|
|
2349
|
-
var options = arguments.length
|
|
2325
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2350
2326
|
|
|
2351
2327
|
var totalStr = '',
|
|
2352
2328
|
totalValues = [];
|
|
@@ -2357,10 +2333,10 @@ function _buildSquel() {
|
|
|
2357
2333
|
|
|
2358
2334
|
try {
|
|
2359
2335
|
for (var _iterator9 = this._orders[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
|
2360
|
-
var
|
|
2361
|
-
var field =
|
|
2362
|
-
var dir =
|
|
2363
|
-
var _values3 =
|
|
2336
|
+
var _ref5 = _step9.value;
|
|
2337
|
+
var field = _ref5.field;
|
|
2338
|
+
var dir = _ref5.dir;
|
|
2339
|
+
var _values3 = _ref5.values;
|
|
2364
2340
|
|
|
2365
2341
|
totalStr = _pad(totalStr, ', ');
|
|
2366
2342
|
|
|
@@ -2408,10 +2384,10 @@ function _buildSquel() {
|
|
|
2408
2384
|
function _class27(options) {
|
|
2409
2385
|
_classCallCheck(this, _class27);
|
|
2410
2386
|
|
|
2411
|
-
var
|
|
2387
|
+
var _this30 = _possibleConstructorReturn(this, (_class27.__proto__ || Object.getPrototypeOf(_class27)).call(this, options));
|
|
2412
2388
|
|
|
2413
|
-
|
|
2414
|
-
return
|
|
2389
|
+
_this30._joins = [];
|
|
2390
|
+
return _this30;
|
|
2415
2391
|
}
|
|
2416
2392
|
|
|
2417
2393
|
/**
|
|
@@ -2431,9 +2407,9 @@ function _buildSquel() {
|
|
|
2431
2407
|
_createClass(_class27, [{
|
|
2432
2408
|
key: 'join',
|
|
2433
2409
|
value: function join(table) {
|
|
2434
|
-
var alias = arguments.length
|
|
2435
|
-
var condition = arguments.length
|
|
2436
|
-
var type = arguments.length
|
|
2410
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2411
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2412
|
+
var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'INNER';
|
|
2437
2413
|
|
|
2438
2414
|
table = this._sanitizeTable(table, true);
|
|
2439
2415
|
alias = alias ? this._sanitizeTableAlias(alias) : alias;
|
|
@@ -2449,55 +2425,55 @@ function _buildSquel() {
|
|
|
2449
2425
|
}, {
|
|
2450
2426
|
key: 'left_join',
|
|
2451
2427
|
value: function left_join(table) {
|
|
2452
|
-
var alias = arguments.length
|
|
2453
|
-
var condition = arguments.length
|
|
2428
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2429
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2454
2430
|
|
|
2455
2431
|
this.join(table, alias, condition, 'LEFT');
|
|
2456
2432
|
}
|
|
2457
2433
|
}, {
|
|
2458
2434
|
key: 'right_join',
|
|
2459
2435
|
value: function right_join(table) {
|
|
2460
|
-
var alias = arguments.length
|
|
2461
|
-
var condition = arguments.length
|
|
2436
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2437
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2462
2438
|
|
|
2463
2439
|
this.join(table, alias, condition, 'RIGHT');
|
|
2464
2440
|
}
|
|
2465
2441
|
}, {
|
|
2466
2442
|
key: 'outer_join',
|
|
2467
2443
|
value: function outer_join(table) {
|
|
2468
|
-
var alias = arguments.length
|
|
2469
|
-
var condition = arguments.length
|
|
2444
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2445
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2470
2446
|
|
|
2471
2447
|
this.join(table, alias, condition, 'OUTER');
|
|
2472
2448
|
}
|
|
2473
2449
|
}, {
|
|
2474
2450
|
key: 'left_outer_join',
|
|
2475
2451
|
value: function left_outer_join(table) {
|
|
2476
|
-
var alias = arguments.length
|
|
2477
|
-
var condition = arguments.length
|
|
2452
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2453
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2478
2454
|
|
|
2479
2455
|
this.join(table, alias, condition, 'LEFT OUTER');
|
|
2480
2456
|
}
|
|
2481
2457
|
}, {
|
|
2482
2458
|
key: 'full_join',
|
|
2483
2459
|
value: function full_join(table) {
|
|
2484
|
-
var alias = arguments.length
|
|
2485
|
-
var condition = arguments.length
|
|
2460
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2461
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2486
2462
|
|
|
2487
2463
|
this.join(table, alias, condition, 'FULL');
|
|
2488
2464
|
}
|
|
2489
2465
|
}, {
|
|
2490
2466
|
key: 'cross_join',
|
|
2491
2467
|
value: function cross_join(table) {
|
|
2492
|
-
var alias = arguments.length
|
|
2493
|
-
var condition = arguments.length
|
|
2468
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2469
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2494
2470
|
|
|
2495
2471
|
this.join(table, alias, condition, 'CROSS');
|
|
2496
2472
|
}
|
|
2497
2473
|
}, {
|
|
2498
2474
|
key: '_toParamString',
|
|
2499
2475
|
value: function _toParamString() {
|
|
2500
|
-
var options = arguments.length
|
|
2476
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2501
2477
|
|
|
2502
2478
|
var totalStr = "",
|
|
2503
2479
|
totalValues = [];
|
|
@@ -2508,11 +2484,11 @@ function _buildSquel() {
|
|
|
2508
2484
|
|
|
2509
2485
|
try {
|
|
2510
2486
|
for (var _iterator10 = this._joins[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
|
|
2511
|
-
var
|
|
2512
|
-
var type =
|
|
2513
|
-
var table =
|
|
2514
|
-
var alias =
|
|
2515
|
-
var condition =
|
|
2487
|
+
var _ref6 = _step10.value;
|
|
2488
|
+
var type = _ref6.type;
|
|
2489
|
+
var table = _ref6.table;
|
|
2490
|
+
var alias = _ref6.alias;
|
|
2491
|
+
var condition = _ref6.condition;
|
|
2516
2492
|
|
|
2517
2493
|
totalStr = _pad(totalStr, this.options.separator);
|
|
2518
2494
|
|
|
@@ -2541,20 +2517,20 @@ function _buildSquel() {
|
|
|
2541
2517
|
if (condition) {
|
|
2542
2518
|
totalStr += ' ON ';
|
|
2543
2519
|
|
|
2544
|
-
var
|
|
2520
|
+
var _ret2 = void 0;
|
|
2545
2521
|
|
|
2546
2522
|
if (cls.isSquelBuilder(condition)) {
|
|
2547
|
-
|
|
2523
|
+
_ret2 = condition._toParamString({
|
|
2548
2524
|
buildParameterized: options.buildParameterized
|
|
2549
2525
|
});
|
|
2550
2526
|
} else {
|
|
2551
|
-
|
|
2527
|
+
_ret2 = this._buildString(condition, [], {
|
|
2552
2528
|
buildParameterized: options.buildParameterized
|
|
2553
2529
|
});
|
|
2554
2530
|
}
|
|
2555
2531
|
|
|
2556
|
-
totalStr += this._applyNestingFormatting(
|
|
2557
|
-
|
|
2532
|
+
totalStr += this._applyNestingFormatting(_ret2.text);
|
|
2533
|
+
_ret2.values.forEach(function (value) {
|
|
2558
2534
|
return totalValues.push(value);
|
|
2559
2535
|
});
|
|
2560
2536
|
}
|
|
@@ -2591,10 +2567,10 @@ function _buildSquel() {
|
|
|
2591
2567
|
function _class28(options) {
|
|
2592
2568
|
_classCallCheck(this, _class28);
|
|
2593
2569
|
|
|
2594
|
-
var
|
|
2570
|
+
var _this31 = _possibleConstructorReturn(this, (_class28.__proto__ || Object.getPrototypeOf(_class28)).call(this, options));
|
|
2595
2571
|
|
|
2596
|
-
|
|
2597
|
-
return
|
|
2572
|
+
_this31._unions = [];
|
|
2573
|
+
return _this31;
|
|
2598
2574
|
}
|
|
2599
2575
|
|
|
2600
2576
|
/**
|
|
@@ -2609,7 +2585,7 @@ function _buildSquel() {
|
|
|
2609
2585
|
_createClass(_class28, [{
|
|
2610
2586
|
key: 'union',
|
|
2611
2587
|
value: function union(table) {
|
|
2612
|
-
var type = arguments.length
|
|
2588
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'UNION';
|
|
2613
2589
|
|
|
2614
2590
|
table = this._sanitizeTable(table);
|
|
2615
2591
|
|
|
@@ -2629,7 +2605,7 @@ function _buildSquel() {
|
|
|
2629
2605
|
}, {
|
|
2630
2606
|
key: '_toParamString',
|
|
2631
2607
|
value: function _toParamString() {
|
|
2632
|
-
var options = arguments.length
|
|
2608
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2633
2609
|
|
|
2634
2610
|
var totalStr = '',
|
|
2635
2611
|
totalValues = [];
|
|
@@ -2640,9 +2616,9 @@ function _buildSquel() {
|
|
|
2640
2616
|
|
|
2641
2617
|
try {
|
|
2642
2618
|
for (var _iterator11 = this._unions[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
|
2643
|
-
var
|
|
2644
|
-
var type =
|
|
2645
|
-
var table =
|
|
2619
|
+
var _ref7 = _step11.value;
|
|
2620
|
+
var type = _ref7.type;
|
|
2621
|
+
var table = _ref7.table;
|
|
2646
2622
|
|
|
2647
2623
|
totalStr = _pad(totalStr, this.options.separator);
|
|
2648
2624
|
|
|
@@ -2712,13 +2688,12 @@ function _buildSquel() {
|
|
|
2712
2688
|
#
|
|
2713
2689
|
# blocks - array of cls.BaseBuilderBlock instances to build the query with.
|
|
2714
2690
|
*/
|
|
2715
|
-
|
|
2716
2691
|
function _class29(options, blocks) {
|
|
2717
2692
|
_classCallCheck(this, _class29);
|
|
2718
2693
|
|
|
2719
|
-
var
|
|
2694
|
+
var _this32 = _possibleConstructorReturn(this, (_class29.__proto__ || Object.getPrototypeOf(_class29)).call(this, options));
|
|
2720
2695
|
|
|
2721
|
-
|
|
2696
|
+
_this32.blocks = blocks || [];
|
|
2722
2697
|
|
|
2723
2698
|
// Copy exposed methods into myself
|
|
2724
2699
|
var _iteratorNormalCompletion12 = true;
|
|
@@ -2726,7 +2701,7 @@ function _buildSquel() {
|
|
|
2726
2701
|
var _iteratorError12 = undefined;
|
|
2727
2702
|
|
|
2728
2703
|
try {
|
|
2729
|
-
for (var _iterator12 =
|
|
2704
|
+
for (var _iterator12 = _this32.blocks[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
|
|
2730
2705
|
var block = _step12.value;
|
|
2731
2706
|
|
|
2732
2707
|
var exposedMethods = block.exposedMethods();
|
|
@@ -2734,19 +2709,19 @@ function _buildSquel() {
|
|
|
2734
2709
|
for (var methodName in exposedMethods) {
|
|
2735
2710
|
var methodBody = exposedMethods[methodName];
|
|
2736
2711
|
|
|
2737
|
-
if (undefined !==
|
|
2712
|
+
if (undefined !== _this32[methodName]) {
|
|
2738
2713
|
throw new Error('Builder already has a builder method called: ' + methodName);
|
|
2739
2714
|
}
|
|
2740
2715
|
|
|
2741
2716
|
(function (block, name, body) {
|
|
2742
|
-
|
|
2717
|
+
_this32[name] = function () {
|
|
2743
2718
|
for (var _len10 = arguments.length, args = Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
2744
2719
|
args[_key10] = arguments[_key10];
|
|
2745
2720
|
}
|
|
2746
2721
|
|
|
2747
2722
|
body.call.apply(body, [block].concat(args));
|
|
2748
2723
|
|
|
2749
|
-
return
|
|
2724
|
+
return _this32;
|
|
2750
2725
|
};
|
|
2751
2726
|
})(block, methodName, methodBody);
|
|
2752
2727
|
}
|
|
@@ -2766,7 +2741,7 @@ function _buildSquel() {
|
|
|
2766
2741
|
}
|
|
2767
2742
|
}
|
|
2768
2743
|
|
|
2769
|
-
return
|
|
2744
|
+
return _this32;
|
|
2770
2745
|
}
|
|
2771
2746
|
|
|
2772
2747
|
/**
|
|
@@ -2804,7 +2779,7 @@ function _buildSquel() {
|
|
|
2804
2779
|
}
|
|
2805
2780
|
}
|
|
2806
2781
|
|
|
2807
|
-
_get(Object.getPrototypeOf(_class29.prototype), 'registerValueHandler', this).call(this, type, handler);
|
|
2782
|
+
_get(_class29.prototype.__proto__ || Object.getPrototypeOf(_class29.prototype), 'registerValueHandler', this).call(this, type, handler);
|
|
2808
2783
|
|
|
2809
2784
|
return this;
|
|
2810
2785
|
}
|
|
@@ -2852,16 +2827,16 @@ function _buildSquel() {
|
|
|
2852
2827
|
}, {
|
|
2853
2828
|
key: '_toParamString',
|
|
2854
2829
|
value: function _toParamString() {
|
|
2855
|
-
var
|
|
2830
|
+
var _this33 = this;
|
|
2856
2831
|
|
|
2857
|
-
var options = arguments.length
|
|
2832
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2858
2833
|
|
|
2859
2834
|
options = _extend({}, this.options, options);
|
|
2860
2835
|
|
|
2861
2836
|
var blockResults = this.blocks.map(function (b) {
|
|
2862
2837
|
return b._toParamString({
|
|
2863
2838
|
buildParameterized: options.buildParameterized,
|
|
2864
|
-
queryBuilder:
|
|
2839
|
+
queryBuilder: _this33
|
|
2865
2840
|
});
|
|
2866
2841
|
});
|
|
2867
2842
|
|
|
@@ -2885,16 +2860,14 @@ function _buildSquel() {
|
|
|
2885
2860
|
|
|
2886
2861
|
if (!options.nested) {
|
|
2887
2862
|
if (options.numberedParameters) {
|
|
2888
|
-
|
|
2889
|
-
var i = undefined !== options.numberedParametersStartAt ? options.numberedParametersStartAt : 1;
|
|
2863
|
+
var i = undefined !== options.numberedParametersStartAt ? options.numberedParametersStartAt : 1;
|
|
2890
2864
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2865
|
+
// construct regex for searching
|
|
2866
|
+
var regex = options.parameterCharacter.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2893
2867
|
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
})();
|
|
2868
|
+
totalStr = totalStr.replace(new RegExp(regex, 'g'), function () {
|
|
2869
|
+
return '' + options.numberedParametersPrefix + i++;
|
|
2870
|
+
});
|
|
2898
2871
|
}
|
|
2899
2872
|
}
|
|
2900
2873
|
|
|
@@ -2937,13 +2910,13 @@ function _buildSquel() {
|
|
|
2937
2910
|
_inherits(_class30, _cls$QueryBuilder);
|
|
2938
2911
|
|
|
2939
2912
|
function _class30(options) {
|
|
2940
|
-
var blocks = arguments.length
|
|
2913
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2941
2914
|
|
|
2942
2915
|
_classCallCheck(this, _class30);
|
|
2943
2916
|
|
|
2944
2917
|
blocks = blocks || [new cls.StringBlock(options, 'SELECT'), new cls.FunctionBlock(options), new cls.DistinctBlock(options), new cls.GetFieldBlock(options), new cls.FromTableBlock(options), new cls.JoinBlock(options), new cls.WhereBlock(options), new cls.GroupByBlock(options), new cls.HavingBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options), new cls.OffsetBlock(options), new cls.UnionBlock(options)];
|
|
2945
2918
|
|
|
2946
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class30).call(this, options, blocks));
|
|
2919
|
+
return _possibleConstructorReturn(this, (_class30.__proto__ || Object.getPrototypeOf(_class30)).call(this, options, blocks));
|
|
2947
2920
|
}
|
|
2948
2921
|
|
|
2949
2922
|
return _class30;
|
|
@@ -2954,13 +2927,13 @@ function _buildSquel() {
|
|
|
2954
2927
|
_inherits(_class31, _cls$QueryBuilder2);
|
|
2955
2928
|
|
|
2956
2929
|
function _class31(options) {
|
|
2957
|
-
var blocks = arguments.length
|
|
2930
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2958
2931
|
|
|
2959
2932
|
_classCallCheck(this, _class31);
|
|
2960
2933
|
|
|
2961
2934
|
blocks = blocks || [new cls.StringBlock(options, 'UPDATE'), new cls.UpdateTableBlock(options), new cls.SetFieldBlock(options), new cls.WhereBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options)];
|
|
2962
2935
|
|
|
2963
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class31).call(this, options, blocks));
|
|
2936
|
+
return _possibleConstructorReturn(this, (_class31.__proto__ || Object.getPrototypeOf(_class31)).call(this, options, blocks));
|
|
2964
2937
|
}
|
|
2965
2938
|
|
|
2966
2939
|
return _class31;
|
|
@@ -2971,7 +2944,7 @@ function _buildSquel() {
|
|
|
2971
2944
|
_inherits(_class32, _cls$QueryBuilder3);
|
|
2972
2945
|
|
|
2973
2946
|
function _class32(options) {
|
|
2974
|
-
var blocks = arguments.length
|
|
2947
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2975
2948
|
|
|
2976
2949
|
_classCallCheck(this, _class32);
|
|
2977
2950
|
|
|
@@ -2979,7 +2952,7 @@ function _buildSquel() {
|
|
|
2979
2952
|
singleTable: true
|
|
2980
2953
|
})), new cls.JoinBlock(options), new cls.WhereBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options)];
|
|
2981
2954
|
|
|
2982
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class32).call(this, options, blocks));
|
|
2955
|
+
return _possibleConstructorReturn(this, (_class32.__proto__ || Object.getPrototypeOf(_class32)).call(this, options, blocks));
|
|
2983
2956
|
}
|
|
2984
2957
|
|
|
2985
2958
|
return _class32;
|
|
@@ -2990,20 +2963,20 @@ function _buildSquel() {
|
|
|
2990
2963
|
_inherits(_class33, _cls$QueryBuilder4);
|
|
2991
2964
|
|
|
2992
2965
|
function _class33(options) {
|
|
2993
|
-
var blocks = arguments.length
|
|
2966
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2994
2967
|
|
|
2995
2968
|
_classCallCheck(this, _class33);
|
|
2996
2969
|
|
|
2997
2970
|
blocks = blocks || [new cls.StringBlock(options, 'INSERT'), new cls.IntoTableBlock(options), new cls.InsertFieldValueBlock(options), new cls.InsertFieldsFromQueryBlock(options)];
|
|
2998
2971
|
|
|
2999
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class33).call(this, options, blocks));
|
|
2972
|
+
return _possibleConstructorReturn(this, (_class33.__proto__ || Object.getPrototypeOf(_class33)).call(this, options, blocks));
|
|
3000
2973
|
}
|
|
3001
2974
|
|
|
3002
2975
|
return _class33;
|
|
3003
2976
|
}(cls.QueryBuilder);
|
|
3004
2977
|
|
|
3005
2978
|
var _squel = {
|
|
3006
|
-
VERSION: '5.
|
|
2979
|
+
VERSION: '5.13.0',
|
|
3007
2980
|
flavour: flavour,
|
|
3008
2981
|
expr: function expr(options) {
|
|
3009
2982
|
return new cls.Expression(options);
|
|
@@ -3070,7 +3043,7 @@ squel.flavours = {};
|
|
|
3070
3043
|
|
|
3071
3044
|
// Setup Squel for a particular SQL flavour
|
|
3072
3045
|
squel.useFlavour = function () {
|
|
3073
|
-
var flavour = arguments.length
|
|
3046
|
+
var flavour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
3074
3047
|
|
|
3075
3048
|
if (!flavour) {
|
|
3076
3049
|
return squel;
|
|
@@ -3109,10 +3082,10 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3109
3082
|
function _class34(options) {
|
|
3110
3083
|
_classCallCheck(this, _class34);
|
|
3111
3084
|
|
|
3112
|
-
var
|
|
3085
|
+
var _this38 = _possibleConstructorReturn(this, (_class34.__proto__ || Object.getPrototypeOf(_class34)).call(this, options));
|
|
3113
3086
|
|
|
3114
|
-
|
|
3115
|
-
|
|
3087
|
+
_this38._limits = null;
|
|
3088
|
+
_this38._offsets = null;
|
|
3116
3089
|
|
|
3117
3090
|
// This is setup as one block to return many as they all have to use each others data at different times
|
|
3118
3091
|
// The build String of EITHER LIMIT OR TOP should execute, never both.
|
|
@@ -3128,31 +3101,31 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3128
3101
|
this._parent._limits = max;
|
|
3129
3102
|
};
|
|
3130
3103
|
|
|
3131
|
-
|
|
3104
|
+
_this38.ParentBlock = function (_cls$Block15) {
|
|
3132
3105
|
_inherits(_class35, _cls$Block15);
|
|
3133
3106
|
|
|
3134
3107
|
function _class35(parent) {
|
|
3135
3108
|
_classCallCheck(this, _class35);
|
|
3136
3109
|
|
|
3137
|
-
var
|
|
3110
|
+
var _this39 = _possibleConstructorReturn(this, (_class35.__proto__ || Object.getPrototypeOf(_class35)).call(this, parent.options));
|
|
3138
3111
|
|
|
3139
|
-
|
|
3140
|
-
return
|
|
3112
|
+
_this39._parent = parent;
|
|
3113
|
+
return _this39;
|
|
3141
3114
|
}
|
|
3142
3115
|
|
|
3143
3116
|
return _class35;
|
|
3144
3117
|
}(cls.Block);
|
|
3145
3118
|
|
|
3146
|
-
|
|
3147
|
-
_inherits(_class36,
|
|
3119
|
+
_this38.LimitBlock = function (_this38$ParentBlock) {
|
|
3120
|
+
_inherits(_class36, _this38$ParentBlock);
|
|
3148
3121
|
|
|
3149
3122
|
function _class36(parent) {
|
|
3150
3123
|
_classCallCheck(this, _class36);
|
|
3151
3124
|
|
|
3152
|
-
var
|
|
3125
|
+
var _this40 = _possibleConstructorReturn(this, (_class36.__proto__ || Object.getPrototypeOf(_class36)).call(this, parent));
|
|
3153
3126
|
|
|
3154
|
-
|
|
3155
|
-
return
|
|
3127
|
+
_this40.limit = _limit;
|
|
3128
|
+
return _this40;
|
|
3156
3129
|
}
|
|
3157
3130
|
|
|
3158
3131
|
_createClass(_class36, [{
|
|
@@ -3172,18 +3145,18 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3172
3145
|
}]);
|
|
3173
3146
|
|
|
3174
3147
|
return _class36;
|
|
3175
|
-
}(
|
|
3148
|
+
}(_this38.ParentBlock);
|
|
3176
3149
|
|
|
3177
|
-
|
|
3178
|
-
_inherits(_class37,
|
|
3150
|
+
_this38.TopBlock = function (_this38$ParentBlock2) {
|
|
3151
|
+
_inherits(_class37, _this38$ParentBlock2);
|
|
3179
3152
|
|
|
3180
3153
|
function _class37(parent) {
|
|
3181
3154
|
_classCallCheck(this, _class37);
|
|
3182
3155
|
|
|
3183
|
-
var
|
|
3156
|
+
var _this41 = _possibleConstructorReturn(this, (_class37.__proto__ || Object.getPrototypeOf(_class37)).call(this, parent));
|
|
3184
3157
|
|
|
3185
|
-
|
|
3186
|
-
return
|
|
3158
|
+
_this41.top = _limit;
|
|
3159
|
+
return _this41;
|
|
3187
3160
|
}
|
|
3188
3161
|
|
|
3189
3162
|
_createClass(_class37, [{
|
|
@@ -3203,15 +3176,15 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3203
3176
|
}]);
|
|
3204
3177
|
|
|
3205
3178
|
return _class37;
|
|
3206
|
-
}(
|
|
3179
|
+
}(_this38.ParentBlock);
|
|
3207
3180
|
|
|
3208
|
-
|
|
3209
|
-
_inherits(_class38,
|
|
3181
|
+
_this38.OffsetBlock = function (_this38$ParentBlock3) {
|
|
3182
|
+
_inherits(_class38, _this38$ParentBlock3);
|
|
3210
3183
|
|
|
3211
3184
|
function _class38() {
|
|
3212
3185
|
_classCallCheck(this, _class38);
|
|
3213
3186
|
|
|
3214
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class38).apply(this, arguments));
|
|
3187
|
+
return _possibleConstructorReturn(this, (_class38.__proto__ || Object.getPrototypeOf(_class38)).apply(this, arguments));
|
|
3215
3188
|
}
|
|
3216
3189
|
|
|
3217
3190
|
_createClass(_class38, [{
|
|
@@ -3236,8 +3209,8 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3236
3209
|
}]);
|
|
3237
3210
|
|
|
3238
3211
|
return _class38;
|
|
3239
|
-
}(
|
|
3240
|
-
return
|
|
3212
|
+
}(_this38.ParentBlock);
|
|
3213
|
+
return _this38;
|
|
3241
3214
|
}
|
|
3242
3215
|
|
|
3243
3216
|
_createClass(_class34, [{
|
|
@@ -3266,14 +3239,14 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3266
3239
|
function _class39(options) {
|
|
3267
3240
|
_classCallCheck(this, _class39);
|
|
3268
3241
|
|
|
3269
|
-
var
|
|
3242
|
+
var _this43 = _possibleConstructorReturn(this, (_class39.__proto__ || Object.getPrototypeOf(_class39)).call(this, options));
|
|
3270
3243
|
|
|
3271
|
-
|
|
3244
|
+
_this43._limits = null;
|
|
3272
3245
|
|
|
3273
|
-
|
|
3274
|
-
|
|
3246
|
+
_this43.limit = _this43.top = function (max) {
|
|
3247
|
+
_this43._limits = _this43._sanitizeLimitOffset(max);
|
|
3275
3248
|
};
|
|
3276
|
-
return
|
|
3249
|
+
return _this43;
|
|
3277
3250
|
}
|
|
3278
3251
|
|
|
3279
3252
|
_createClass(_class39, [{
|
|
@@ -3295,10 +3268,10 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3295
3268
|
function _class40(options) {
|
|
3296
3269
|
_classCallCheck(this, _class40);
|
|
3297
3270
|
|
|
3298
|
-
var
|
|
3271
|
+
var _this44 = _possibleConstructorReturn(this, (_class40.__proto__ || Object.getPrototypeOf(_class40)).call(this, options));
|
|
3299
3272
|
|
|
3300
|
-
|
|
3301
|
-
return
|
|
3273
|
+
_this44._outputs = [];
|
|
3274
|
+
return _this44;
|
|
3302
3275
|
}
|
|
3303
3276
|
|
|
3304
3277
|
// add fields to the output clause
|
|
@@ -3307,20 +3280,20 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3307
3280
|
_createClass(_class40, [{
|
|
3308
3281
|
key: 'output',
|
|
3309
3282
|
value: function output(fields) {
|
|
3310
|
-
var
|
|
3283
|
+
var _this45 = this;
|
|
3311
3284
|
|
|
3312
3285
|
if ('string' === typeof fields) {
|
|
3313
3286
|
this._outputs.push('INSERTED.' + this._sanitizeField(fields));
|
|
3314
3287
|
} else {
|
|
3315
3288
|
fields.forEach(function (f) {
|
|
3316
|
-
|
|
3289
|
+
_this45._outputs.push('INSERTED.' + _this45._sanitizeField(f));
|
|
3317
3290
|
});
|
|
3318
3291
|
}
|
|
3319
3292
|
}
|
|
3320
3293
|
}, {
|
|
3321
3294
|
key: '_toParamString',
|
|
3322
3295
|
value: function _toParamString(options) {
|
|
3323
|
-
var ret = _get(Object.getPrototypeOf(_class40.prototype), '_toParamString', this).call(this, options);
|
|
3296
|
+
var ret = _get(_class40.prototype.__proto__ || Object.getPrototypeOf(_class40.prototype), '_toParamString', this).call(this, options);
|
|
3324
3297
|
|
|
3325
3298
|
if (ret.text.length && 0 < this._outputs.length) {
|
|
3326
3299
|
var innerStr = 'OUTPUT ' + this._outputs.join(', ') + ' ';
|
|
@@ -3343,10 +3316,10 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3343
3316
|
function _class41(options) {
|
|
3344
3317
|
_classCallCheck(this, _class41);
|
|
3345
3318
|
|
|
3346
|
-
var
|
|
3319
|
+
var _this46 = _possibleConstructorReturn(this, (_class41.__proto__ || Object.getPrototypeOf(_class41)).call(this, options));
|
|
3347
3320
|
|
|
3348
|
-
|
|
3349
|
-
return
|
|
3321
|
+
_this46._outputs = [];
|
|
3322
|
+
return _this46;
|
|
3350
3323
|
}
|
|
3351
3324
|
|
|
3352
3325
|
/**
|
|
@@ -3379,7 +3352,7 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3379
3352
|
}, {
|
|
3380
3353
|
key: 'output',
|
|
3381
3354
|
value: function output(_output) {
|
|
3382
|
-
var alias = arguments.length
|
|
3355
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3383
3356
|
|
|
3384
3357
|
_output = this._sanitizeField(_output);
|
|
3385
3358
|
alias = alias ? this._sanitizeFieldAlias(alias) : alias;
|
|
@@ -3444,7 +3417,7 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3444
3417
|
_inherits(_class42, _cls$QueryBuilder5);
|
|
3445
3418
|
|
|
3446
3419
|
function _class42(options) {
|
|
3447
|
-
var blocks = arguments.length
|
|
3420
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3448
3421
|
|
|
3449
3422
|
_classCallCheck(this, _class42);
|
|
3450
3423
|
|
|
@@ -3452,7 +3425,7 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3452
3425
|
|
|
3453
3426
|
blocks = blocks || [new cls.StringBlock(options, 'SELECT'), new cls.DistinctBlock(options), limitOffsetTopBlock.TOP(), new cls.GetFieldBlock(options), new cls.FromTableBlock(options), new cls.JoinBlock(options), new cls.WhereBlock(options), new cls.GroupByBlock(options), new cls.OrderByBlock(options), limitOffsetTopBlock.OFFSET(), limitOffsetTopBlock.LIMIT(), new cls.UnionBlock(options)];
|
|
3454
3427
|
|
|
3455
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class42).call(this, options, blocks));
|
|
3428
|
+
return _possibleConstructorReturn(this, (_class42.__proto__ || Object.getPrototypeOf(_class42)).call(this, options, blocks));
|
|
3456
3429
|
}
|
|
3457
3430
|
|
|
3458
3431
|
return _class42;
|
|
@@ -3465,13 +3438,13 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3465
3438
|
_inherits(_class43, _cls$QueryBuilder6);
|
|
3466
3439
|
|
|
3467
3440
|
function _class43(options) {
|
|
3468
|
-
var blocks = arguments.length
|
|
3441
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3469
3442
|
|
|
3470
3443
|
_classCallCheck(this, _class43);
|
|
3471
3444
|
|
|
3472
3445
|
blocks = blocks || [new cls.StringBlock(options, 'UPDATE'), new cls.MssqlUpdateTopBlock(options), new cls.UpdateTableBlock(options), new cls.SetFieldBlock(options), new cls.MssqlUpdateDeleteOutputBlock(options), new cls.WhereBlock(options)];
|
|
3473
3446
|
|
|
3474
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class43).call(this, options, blocks));
|
|
3447
|
+
return _possibleConstructorReturn(this, (_class43.__proto__ || Object.getPrototypeOf(_class43)).call(this, options, blocks));
|
|
3475
3448
|
}
|
|
3476
3449
|
|
|
3477
3450
|
return _class43;
|
|
@@ -3484,13 +3457,13 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3484
3457
|
_inherits(_class44, _cls$QueryBuilder7);
|
|
3485
3458
|
|
|
3486
3459
|
function _class44(options) {
|
|
3487
|
-
var blocks = arguments.length
|
|
3460
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3488
3461
|
|
|
3489
3462
|
_classCallCheck(this, _class44);
|
|
3490
3463
|
|
|
3491
3464
|
blocks = blocks || [new cls.StringBlock(options, 'DELETE'), new cls.TargetTableBlock(options), new cls.FromTableBlock(_extend({}, options, { singleTable: true })), new cls.JoinBlock(options), new cls.MssqlUpdateDeleteOutputBlock(_extend({}, options, { forDelete: true })), new cls.WhereBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options)];
|
|
3492
3465
|
|
|
3493
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class44).call(this, options, blocks));
|
|
3466
|
+
return _possibleConstructorReturn(this, (_class44.__proto__ || Object.getPrototypeOf(_class44)).call(this, options, blocks));
|
|
3494
3467
|
}
|
|
3495
3468
|
|
|
3496
3469
|
return _class44;
|
|
@@ -3501,13 +3474,13 @@ squel.flavours['mssql'] = function (_squel) {
|
|
|
3501
3474
|
_inherits(_class45, _cls$QueryBuilder8);
|
|
3502
3475
|
|
|
3503
3476
|
function _class45(options) {
|
|
3504
|
-
var blocks = arguments.length
|
|
3477
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3505
3478
|
|
|
3506
3479
|
_classCallCheck(this, _class45);
|
|
3507
3480
|
|
|
3508
3481
|
blocks = blocks || [new cls.StringBlock(options, 'INSERT'), new cls.IntoTableBlock(options), new cls.MssqlInsertFieldValueBlock(options), new cls.InsertFieldsFromQueryBlock(options)];
|
|
3509
3482
|
|
|
3510
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class45).call(this, options, blocks));
|
|
3483
|
+
return _possibleConstructorReturn(this, (_class45.__proto__ || Object.getPrototypeOf(_class45)).call(this, options, blocks));
|
|
3511
3484
|
}
|
|
3512
3485
|
|
|
3513
3486
|
return _class45;
|
|
@@ -3526,7 +3499,7 @@ squel.flavours['mysql'] = function (_squel) {
|
|
|
3526
3499
|
function _class46() {
|
|
3527
3500
|
_classCallCheck(this, _class46);
|
|
3528
3501
|
|
|
3529
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class46).apply(this, arguments));
|
|
3502
|
+
return _possibleConstructorReturn(this, (_class46.__proto__ || Object.getPrototypeOf(_class46)).apply(this, arguments));
|
|
3530
3503
|
}
|
|
3531
3504
|
|
|
3532
3505
|
_createClass(_class46, [{
|
|
@@ -3537,7 +3510,7 @@ squel.flavours['mysql'] = function (_squel) {
|
|
|
3537
3510
|
}, {
|
|
3538
3511
|
key: '_toParamString',
|
|
3539
3512
|
value: function _toParamString() {
|
|
3540
|
-
var options = arguments.length
|
|
3513
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3541
3514
|
|
|
3542
3515
|
var totalStr = "",
|
|
3543
3516
|
totalValues = [];
|
|
@@ -3582,13 +3555,13 @@ squel.flavours['mysql'] = function (_squel) {
|
|
|
3582
3555
|
_inherits(_class47, _cls$QueryBuilder9);
|
|
3583
3556
|
|
|
3584
3557
|
function _class47(options) {
|
|
3585
|
-
var blocks = arguments.length
|
|
3558
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3586
3559
|
|
|
3587
3560
|
_classCallCheck(this, _class47);
|
|
3588
3561
|
|
|
3589
3562
|
blocks = blocks || [new cls.StringBlock(options, 'INSERT'), new cls.IntoTableBlock(options), new cls.InsertFieldValueBlock(options), new cls.InsertFieldsFromQueryBlock(options), new cls.MysqlOnDuplicateKeyUpdateBlock(options)];
|
|
3590
3563
|
|
|
3591
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class47).call(this, options, blocks));
|
|
3564
|
+
return _possibleConstructorReturn(this, (_class47.__proto__ || Object.getPrototypeOf(_class47)).call(this, options, blocks));
|
|
3592
3565
|
}
|
|
3593
3566
|
|
|
3594
3567
|
return _class47;
|
|
@@ -3599,13 +3572,13 @@ squel.flavours['mysql'] = function (_squel) {
|
|
|
3599
3572
|
_inherits(_class48, _cls$QueryBuilder10);
|
|
3600
3573
|
|
|
3601
3574
|
function _class48(options) {
|
|
3602
|
-
var blocks = arguments.length
|
|
3575
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3603
3576
|
|
|
3604
3577
|
_classCallCheck(this, _class48);
|
|
3605
3578
|
|
|
3606
3579
|
blocks = blocks || [new cls.StringBlock(options, 'REPLACE'), new cls.IntoTableBlock(options), new cls.InsertFieldValueBlock(options), new cls.InsertFieldsFromQueryBlock(options)];
|
|
3607
3580
|
|
|
3608
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class48).call(this, options, blocks));
|
|
3581
|
+
return _possibleConstructorReturn(this, (_class48.__proto__ || Object.getPrototypeOf(_class48)).call(this, options, blocks));
|
|
3609
3582
|
}
|
|
3610
3583
|
|
|
3611
3584
|
return _class48;
|
|
@@ -3631,13 +3604,13 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3631
3604
|
function _class49() {
|
|
3632
3605
|
_classCallCheck(this, _class49);
|
|
3633
3606
|
|
|
3634
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class49).apply(this, arguments));
|
|
3607
|
+
return _possibleConstructorReturn(this, (_class49.__proto__ || Object.getPrototypeOf(_class49)).apply(this, arguments));
|
|
3635
3608
|
}
|
|
3636
3609
|
|
|
3637
3610
|
_createClass(_class49, [{
|
|
3638
3611
|
key: 'onConflict',
|
|
3639
3612
|
value: function onConflict(conflictFields, fields) {
|
|
3640
|
-
var
|
|
3613
|
+
var _this55 = this;
|
|
3641
3614
|
|
|
3642
3615
|
this._onConflict = true;
|
|
3643
3616
|
if (!conflictFields) {
|
|
@@ -3650,14 +3623,14 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3650
3623
|
|
|
3651
3624
|
if (fields) {
|
|
3652
3625
|
Object.keys(fields).forEach(function (key) {
|
|
3653
|
-
|
|
3626
|
+
_this55._set(key, fields[key]);
|
|
3654
3627
|
});
|
|
3655
3628
|
}
|
|
3656
3629
|
}
|
|
3657
3630
|
}, {
|
|
3658
3631
|
key: '_toParamString',
|
|
3659
3632
|
value: function _toParamString() {
|
|
3660
|
-
var options = arguments.length
|
|
3633
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3661
3634
|
|
|
3662
3635
|
var totalStr = "",
|
|
3663
3636
|
totalValues = [];
|
|
@@ -3713,17 +3686,17 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3713
3686
|
function _class50(options) {
|
|
3714
3687
|
_classCallCheck(this, _class50);
|
|
3715
3688
|
|
|
3716
|
-
var
|
|
3689
|
+
var _this56 = _possibleConstructorReturn(this, (_class50.__proto__ || Object.getPrototypeOf(_class50)).call(this, options));
|
|
3717
3690
|
|
|
3718
|
-
|
|
3719
|
-
return
|
|
3691
|
+
_this56._fields = [];
|
|
3692
|
+
return _this56;
|
|
3720
3693
|
}
|
|
3721
3694
|
|
|
3722
3695
|
_createClass(_class50, [{
|
|
3723
3696
|
key: 'returning',
|
|
3724
3697
|
value: function returning(field) {
|
|
3725
|
-
var alias = arguments.length
|
|
3726
|
-
var options = arguments.length
|
|
3698
|
+
var alias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3699
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3727
3700
|
|
|
3728
3701
|
alias = alias ? this._sanitizeFieldAlias(alias) : alias;
|
|
3729
3702
|
field = this._sanitizeField(field);
|
|
@@ -3745,9 +3718,9 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3745
3718
|
}, {
|
|
3746
3719
|
key: '_toParamString',
|
|
3747
3720
|
value: function _toParamString() {
|
|
3748
|
-
var options = arguments.length
|
|
3749
|
-
var queryBuilder = options.queryBuilder
|
|
3750
|
-
|
|
3721
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3722
|
+
var queryBuilder = options.queryBuilder,
|
|
3723
|
+
buildParameterized = options.buildParameterized;
|
|
3751
3724
|
|
|
3752
3725
|
|
|
3753
3726
|
var totalStr = '',
|
|
@@ -3763,9 +3736,9 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3763
3736
|
|
|
3764
3737
|
totalStr = _pad(totalStr, ", ");
|
|
3765
3738
|
|
|
3766
|
-
var name = field.name
|
|
3767
|
-
|
|
3768
|
-
|
|
3739
|
+
var name = field.name,
|
|
3740
|
+
alias = field.alias,
|
|
3741
|
+
_options2 = field.options;
|
|
3769
3742
|
|
|
3770
3743
|
|
|
3771
3744
|
if (typeof name === 'string') {
|
|
@@ -3818,10 +3791,10 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3818
3791
|
function _class51(options) {
|
|
3819
3792
|
_classCallCheck(this, _class51);
|
|
3820
3793
|
|
|
3821
|
-
var
|
|
3794
|
+
var _this57 = _possibleConstructorReturn(this, (_class51.__proto__ || Object.getPrototypeOf(_class51)).call(this, options));
|
|
3822
3795
|
|
|
3823
|
-
|
|
3824
|
-
return
|
|
3796
|
+
_this57._tables = [];
|
|
3797
|
+
return _this57;
|
|
3825
3798
|
}
|
|
3826
3799
|
|
|
3827
3800
|
_createClass(_class51, [{
|
|
@@ -3832,7 +3805,7 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3832
3805
|
}, {
|
|
3833
3806
|
key: '_toParamString',
|
|
3834
3807
|
value: function _toParamString() {
|
|
3835
|
-
var options = arguments.length
|
|
3808
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3836
3809
|
|
|
3837
3810
|
var parts = [];
|
|
3838
3811
|
var values = [];
|
|
@@ -3843,9 +3816,9 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3843
3816
|
|
|
3844
3817
|
try {
|
|
3845
3818
|
for (var _iterator17 = this._tables[Symbol.iterator](), _step17; !(_iteratorNormalCompletion17 = (_step17 = _iterator17.next()).done); _iteratorNormalCompletion17 = true) {
|
|
3846
|
-
var
|
|
3847
|
-
var alias =
|
|
3848
|
-
var table =
|
|
3819
|
+
var _ref8 = _step17.value;
|
|
3820
|
+
var alias = _ref8.alias;
|
|
3821
|
+
var table = _ref8.table;
|
|
3849
3822
|
|
|
3850
3823
|
var ret = table._toParamString({
|
|
3851
3824
|
buildParameterized: options.buildParameterized,
|
|
@@ -3889,16 +3862,16 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3889
3862
|
function _class52(options) {
|
|
3890
3863
|
_classCallCheck(this, _class52);
|
|
3891
3864
|
|
|
3892
|
-
var
|
|
3865
|
+
var _this58 = _possibleConstructorReturn(this, (_class52.__proto__ || Object.getPrototypeOf(_class52)).call(this, options));
|
|
3893
3866
|
|
|
3894
|
-
|
|
3895
|
-
return
|
|
3867
|
+
_this58._distinctFields = [];
|
|
3868
|
+
return _this58;
|
|
3896
3869
|
}
|
|
3897
3870
|
|
|
3898
3871
|
_createClass(_class52, [{
|
|
3899
3872
|
key: 'distinct',
|
|
3900
3873
|
value: function distinct() {
|
|
3901
|
-
var
|
|
3874
|
+
var _this59 = this;
|
|
3902
3875
|
|
|
3903
3876
|
this._useDistinct = true;
|
|
3904
3877
|
|
|
@@ -3909,7 +3882,7 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3909
3882
|
}
|
|
3910
3883
|
|
|
3911
3884
|
fields.forEach(function (field) {
|
|
3912
|
-
|
|
3885
|
+
_this59._distinctFields.push(_this59._sanitizeField(field));
|
|
3913
3886
|
});
|
|
3914
3887
|
}
|
|
3915
3888
|
}, {
|
|
@@ -3940,13 +3913,13 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3940
3913
|
_inherits(_class53, _cls$QueryBuilder11);
|
|
3941
3914
|
|
|
3942
3915
|
function _class53(options) {
|
|
3943
|
-
var blocks = arguments.length
|
|
3916
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3944
3917
|
|
|
3945
3918
|
_classCallCheck(this, _class53);
|
|
3946
3919
|
|
|
3947
3920
|
blocks = blocks || [new cls.WithBlock(options), new cls.StringBlock(options, 'SELECT'), new cls.FunctionBlock(options), new cls.DistinctOnBlock(options), new cls.GetFieldBlock(options), new cls.FromTableBlock(options), new cls.JoinBlock(options), new cls.WhereBlock(options), new cls.GroupByBlock(options), new cls.HavingBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options), new cls.OffsetBlock(options), new cls.UnionBlock(options)];
|
|
3948
3921
|
|
|
3949
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class53).call(this, options, blocks));
|
|
3922
|
+
return _possibleConstructorReturn(this, (_class53.__proto__ || Object.getPrototypeOf(_class53)).call(this, options, blocks));
|
|
3950
3923
|
}
|
|
3951
3924
|
|
|
3952
3925
|
return _class53;
|
|
@@ -3957,13 +3930,13 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3957
3930
|
_inherits(_class54, _cls$QueryBuilder12);
|
|
3958
3931
|
|
|
3959
3932
|
function _class54(options) {
|
|
3960
|
-
var blocks = arguments.length
|
|
3933
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3961
3934
|
|
|
3962
3935
|
_classCallCheck(this, _class54);
|
|
3963
3936
|
|
|
3964
3937
|
blocks = blocks || [new cls.WithBlock(options), new cls.StringBlock(options, 'INSERT'), new cls.IntoTableBlock(options), new cls.InsertFieldValueBlock(options), new cls.InsertFieldsFromQueryBlock(options), new cls.PostgresOnConflictKeyUpdateBlock(options), new cls.ReturningBlock(options)];
|
|
3965
3938
|
|
|
3966
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class54).call(this, options, blocks));
|
|
3939
|
+
return _possibleConstructorReturn(this, (_class54.__proto__ || Object.getPrototypeOf(_class54)).call(this, options, blocks));
|
|
3967
3940
|
}
|
|
3968
3941
|
|
|
3969
3942
|
return _class54;
|
|
@@ -3974,13 +3947,13 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3974
3947
|
_inherits(_class55, _cls$QueryBuilder13);
|
|
3975
3948
|
|
|
3976
3949
|
function _class55(options) {
|
|
3977
|
-
var blocks = arguments.length
|
|
3950
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3978
3951
|
|
|
3979
3952
|
_classCallCheck(this, _class55);
|
|
3980
3953
|
|
|
3981
3954
|
blocks = blocks || [new cls.WithBlock(options), new cls.StringBlock(options, 'UPDATE'), new cls.UpdateTableBlock(options), new cls.SetFieldBlock(options), new cls.FromTableBlock(options), new cls.WhereBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options), new cls.ReturningBlock(options)];
|
|
3982
3955
|
|
|
3983
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class55).call(this, options, blocks));
|
|
3956
|
+
return _possibleConstructorReturn(this, (_class55.__proto__ || Object.getPrototypeOf(_class55)).call(this, options, blocks));
|
|
3984
3957
|
}
|
|
3985
3958
|
|
|
3986
3959
|
return _class55;
|
|
@@ -3991,7 +3964,7 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3991
3964
|
_inherits(_class56, _cls$QueryBuilder14);
|
|
3992
3965
|
|
|
3993
3966
|
function _class56(options) {
|
|
3994
|
-
var blocks = arguments.length
|
|
3967
|
+
var blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3995
3968
|
|
|
3996
3969
|
_classCallCheck(this, _class56);
|
|
3997
3970
|
|
|
@@ -3999,7 +3972,7 @@ squel.flavours['postgres'] = function (_squel) {
|
|
|
3999
3972
|
singleTable: true
|
|
4000
3973
|
})), new cls.JoinBlock(options), new cls.WhereBlock(options), new cls.OrderByBlock(options), new cls.LimitBlock(options), new cls.ReturningBlock(options)];
|
|
4001
3974
|
|
|
4002
|
-
return _possibleConstructorReturn(this, Object.getPrototypeOf(_class56).call(this, options, blocks));
|
|
3975
|
+
return _possibleConstructorReturn(this, (_class56.__proto__ || Object.getPrototypeOf(_class56)).call(this, options, blocks));
|
|
4003
3976
|
}
|
|
4004
3977
|
|
|
4005
3978
|
return _class56;
|