squel 6.2.1 → 6.3.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 +7 -0
- package/README.md +18 -0
- package/dist/browser/squel.min.js +1 -1
- package/dist/cjs/index.js +32 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +32 -5
- package/dist/esm/index.js.map +4 -4
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "squel",
|
|
4
|
-
version: "6.
|
|
4
|
+
version: "6.3.0",
|
|
5
5
|
description: "SQL query string builder",
|
|
6
6
|
keywords: [
|
|
7
7
|
"sql",
|
|
@@ -1215,7 +1215,7 @@ function _buildSquel(flavour = null) {
|
|
|
1215
1215
|
_toParamString(options = {}) {
|
|
1216
1216
|
let totalStr = "";
|
|
1217
1217
|
const totalValues = [];
|
|
1218
|
-
for (const { type, table, alias, condition } of this._joins) {
|
|
1218
|
+
for (const { type, table, alias, condition, isApply } of this._joins) {
|
|
1219
1219
|
totalStr = _pad(totalStr, this.options.separator);
|
|
1220
1220
|
let tableStr;
|
|
1221
1221
|
if (cls.isSquelBuilder(table)) {
|
|
@@ -1228,7 +1228,11 @@ function _buildSquel(flavour = null) {
|
|
|
1228
1228
|
} else {
|
|
1229
1229
|
tableStr = this._formatTableName(table);
|
|
1230
1230
|
}
|
|
1231
|
-
|
|
1231
|
+
if (isApply) {
|
|
1232
|
+
totalStr += `${type} ${tableStr}`;
|
|
1233
|
+
} else {
|
|
1234
|
+
totalStr += `${type} JOIN ${tableStr}`;
|
|
1235
|
+
}
|
|
1232
1236
|
if (alias)
|
|
1233
1237
|
totalStr += ` ${this._formatTableAlias(alias)}`;
|
|
1234
1238
|
if (condition) {
|
|
@@ -2029,6 +2033,29 @@ squel.flavours.mssql = (_squel) => {
|
|
|
2029
2033
|
return { text: totalStr, values: [] };
|
|
2030
2034
|
}
|
|
2031
2035
|
};
|
|
2036
|
+
cls.MssqlJoinBlock = class extends cls.JoinBlock {
|
|
2037
|
+
apply(table, alias = null, type = "CROSS") {
|
|
2038
|
+
table = this._sanitizeTable(table, true);
|
|
2039
|
+
alias = alias ? this._sanitizeTableAlias(alias) : alias;
|
|
2040
|
+
let applyType = type.toUpperCase();
|
|
2041
|
+
if (!applyType.endsWith("APPLY")) {
|
|
2042
|
+
applyType = `${applyType} APPLY`;
|
|
2043
|
+
}
|
|
2044
|
+
this._joins.push({
|
|
2045
|
+
type: applyType,
|
|
2046
|
+
table,
|
|
2047
|
+
alias,
|
|
2048
|
+
condition: null,
|
|
2049
|
+
isApply: true
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
cross_apply(table, alias = null) {
|
|
2053
|
+
this.apply(table, alias, "CROSS");
|
|
2054
|
+
}
|
|
2055
|
+
outer_apply(table, alias = null) {
|
|
2056
|
+
this.apply(table, alias, "OUTER");
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2032
2059
|
cls.Select = class extends cls.QueryBuilder {
|
|
2033
2060
|
constructor(options, blocks = null) {
|
|
2034
2061
|
const limitOffsetTopBlock = new cls.MssqlLimitOffsetTopBlock(options);
|
|
@@ -2039,7 +2066,7 @@ squel.flavours.mssql = (_squel) => {
|
|
|
2039
2066
|
limitOffsetTopBlock.TOP(),
|
|
2040
2067
|
new cls.GetFieldBlock(options),
|
|
2041
2068
|
new cls.FromTableBlock(options),
|
|
2042
|
-
new cls.
|
|
2069
|
+
new cls.MssqlJoinBlock(options),
|
|
2043
2070
|
new cls.WhereBlock(options),
|
|
2044
2071
|
new cls.GroupByBlock(options),
|
|
2045
2072
|
new cls.HavingBlock(options),
|
|
@@ -2295,4 +2322,4 @@ export {
|
|
|
2295
2322
|
src_default as default
|
|
2296
2323
|
};
|
|
2297
2324
|
|
|
2298
|
-
//# debugId=
|
|
2325
|
+
//# debugId=C3B9A8DC1888720164756E2164756E21
|