pqb 0.48.0 → 0.48.2
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/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2099,6 +2099,7 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
2099
2099
|
const tableName = data.aliases?.[table] || table;
|
|
2100
2100
|
const quoted = `"${table}"`;
|
|
2101
2101
|
const col = quoted === quotedAs ? data.shape[key] : data.joinedShapes?.[tableName][key];
|
|
2102
|
+
if (jsonList) jsonList[as] = col;
|
|
2102
2103
|
if (col) {
|
|
2103
2104
|
if (col.data.name && col.data.name !== key) {
|
|
2104
2105
|
return `"${tableName}"."${col.data.name}" "${as}"`;
|
|
@@ -2113,11 +2114,11 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
2113
2114
|
)} "${as}"`;
|
|
2114
2115
|
}
|
|
2115
2116
|
}
|
|
2116
|
-
if (jsonList) jsonList[as] = col;
|
|
2117
2117
|
return `"${tableName}"."${key}"${key === as ? "" : ` "${as}"`}`;
|
|
2118
2118
|
};
|
|
2119
2119
|
const ownColumnToSqlWithAs = (ctx, data, column, as, quotedAs, select, jsonList) => {
|
|
2120
2120
|
const col = data.shape[column];
|
|
2121
|
+
if (jsonList) jsonList[as] = col;
|
|
2121
2122
|
if (col) {
|
|
2122
2123
|
if (col.data.name && col.data.name !== column) {
|
|
2123
2124
|
return `${quotedAs ? `${quotedAs}.` : ""}"${col.data.name}"${col.data.name === as ? "" : ` "${as}"`}`;
|
|
@@ -2132,7 +2133,6 @@ const ownColumnToSqlWithAs = (ctx, data, column, as, quotedAs, select, jsonList)
|
|
|
2132
2133
|
)} "${as}"`;
|
|
2133
2134
|
}
|
|
2134
2135
|
}
|
|
2135
|
-
if (jsonList) jsonList[as] = col;
|
|
2136
2136
|
return `${quotedAs ? `${quotedAs}.` : ""}"${column}"${column === as ? "" : ` "${as}"`}`;
|
|
2137
2137
|
};
|
|
2138
2138
|
const rawOrColumnToSql = (ctx, data, expr, quotedAs, shape = data.shape, select) => {
|
|
@@ -5305,7 +5305,7 @@ const pushUpdateSql = (ctx, table, query, quotedAs) => {
|
|
|
5305
5305
|
}
|
|
5306
5306
|
ctx.sql.push(`UPDATE ${quotedTable}`);
|
|
5307
5307
|
if (quotedTable !== quotedAs) {
|
|
5308
|
-
ctx.sql.push(
|
|
5308
|
+
ctx.sql.push(quotedAs);
|
|
5309
5309
|
}
|
|
5310
5310
|
ctx.sql.push("SET");
|
|
5311
5311
|
ctx.sql.push(set.join(", "));
|
|
@@ -5377,7 +5377,7 @@ const pushDeleteSql = (ctx, table, query, quotedAs) => {
|
|
|
5377
5377
|
const from = `"${table.table}"`;
|
|
5378
5378
|
ctx.sql.push(`DELETE FROM ${from}`);
|
|
5379
5379
|
if (from !== quotedAs) {
|
|
5380
|
-
ctx.sql.push(
|
|
5380
|
+
ctx.sql.push(quotedAs);
|
|
5381
5381
|
}
|
|
5382
5382
|
let conditions;
|
|
5383
5383
|
if (query.join?.length) {
|
|
@@ -5866,7 +5866,7 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
|
5866
5866
|
const as = j.q.as;
|
|
5867
5867
|
const joinAs = `"${as}"`;
|
|
5868
5868
|
if (as !== tableName) {
|
|
5869
|
-
target += `
|
|
5869
|
+
target += ` ${joinAs}`;
|
|
5870
5870
|
}
|
|
5871
5871
|
if (r && s) {
|
|
5872
5872
|
target = `LATERAL ${subJoinToSql(ctx, j, quotedTable, joinAs, true)}`;
|
|
@@ -5961,7 +5961,7 @@ const getArgQueryTarget = (ctx, first, joinSubQuery, cloned) => {
|
|
|
5961
5961
|
let target = quotedFrom || quoteSchemaAndTable(joinQuery.schema, first.table);
|
|
5962
5962
|
if (addAs) {
|
|
5963
5963
|
joinAs = qAs;
|
|
5964
|
-
target += `
|
|
5964
|
+
target += ` ${qAs}`;
|
|
5965
5965
|
}
|
|
5966
5966
|
return { target, joinAs };
|
|
5967
5967
|
}
|
|
@@ -12745,7 +12745,7 @@ class Db extends QueryMethods {
|
|
|
12745
12745
|
const column = shape[key];
|
|
12746
12746
|
if (!column.data.explicitSelect) {
|
|
12747
12747
|
list.push(
|
|
12748
|
-
column.data.name ? `"${column.data.name}"
|
|
12748
|
+
column.data.name ? `"${column.data.name}" "${key}"` : `"${key}"`
|
|
12749
12749
|
);
|
|
12750
12750
|
keys[key] = column;
|
|
12751
12751
|
}
|