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-basic.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();
|
|
94
|
-
|
|
95
|
-
Object.getOwnPropertyNames(src).forEach(function (key) {
|
|
96
|
-
if (typeof src[key] !== 'function') {
|
|
97
|
-
ret[key] = _clone(src[key]);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
92
|
+
var ret = new src.constructor();
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
|
|
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;
|