pqb 0.48.1 → 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.js
CHANGED
|
@@ -2101,6 +2101,7 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
2101
2101
|
const tableName = data.aliases?.[table] || table;
|
|
2102
2102
|
const quoted = `"${table}"`;
|
|
2103
2103
|
const col = quoted === quotedAs ? data.shape[key] : data.joinedShapes?.[tableName][key];
|
|
2104
|
+
if (jsonList) jsonList[as] = col;
|
|
2104
2105
|
if (col) {
|
|
2105
2106
|
if (col.data.name && col.data.name !== key) {
|
|
2106
2107
|
return `"${tableName}"."${col.data.name}" "${as}"`;
|
|
@@ -2115,11 +2116,11 @@ const tableColumnToSqlWithAs = (ctx, data, column, table, key, as, quotedAs, sel
|
|
|
2115
2116
|
)} "${as}"`;
|
|
2116
2117
|
}
|
|
2117
2118
|
}
|
|
2118
|
-
if (jsonList) jsonList[as] = col;
|
|
2119
2119
|
return `"${tableName}"."${key}"${key === as ? "" : ` "${as}"`}`;
|
|
2120
2120
|
};
|
|
2121
2121
|
const ownColumnToSqlWithAs = (ctx, data, column, as, quotedAs, select, jsonList) => {
|
|
2122
2122
|
const col = data.shape[column];
|
|
2123
|
+
if (jsonList) jsonList[as] = col;
|
|
2123
2124
|
if (col) {
|
|
2124
2125
|
if (col.data.name && col.data.name !== column) {
|
|
2125
2126
|
return `${quotedAs ? `${quotedAs}.` : ""}"${col.data.name}"${col.data.name === as ? "" : ` "${as}"`}`;
|
|
@@ -2134,7 +2135,6 @@ const ownColumnToSqlWithAs = (ctx, data, column, as, quotedAs, select, jsonList)
|
|
|
2134
2135
|
)} "${as}"`;
|
|
2135
2136
|
}
|
|
2136
2137
|
}
|
|
2137
|
-
if (jsonList) jsonList[as] = col;
|
|
2138
2138
|
return `${quotedAs ? `${quotedAs}.` : ""}"${column}"${column === as ? "" : ` "${as}"`}`;
|
|
2139
2139
|
};
|
|
2140
2140
|
const rawOrColumnToSql = (ctx, data, expr, quotedAs, shape = data.shape, select) => {
|
|
@@ -5307,7 +5307,7 @@ const pushUpdateSql = (ctx, table, query, quotedAs) => {
|
|
|
5307
5307
|
}
|
|
5308
5308
|
ctx.sql.push(`UPDATE ${quotedTable}`);
|
|
5309
5309
|
if (quotedTable !== quotedAs) {
|
|
5310
|
-
ctx.sql.push(
|
|
5310
|
+
ctx.sql.push(quotedAs);
|
|
5311
5311
|
}
|
|
5312
5312
|
ctx.sql.push("SET");
|
|
5313
5313
|
ctx.sql.push(set.join(", "));
|
|
@@ -5379,7 +5379,7 @@ const pushDeleteSql = (ctx, table, query, quotedAs) => {
|
|
|
5379
5379
|
const from = `"${table.table}"`;
|
|
5380
5380
|
ctx.sql.push(`DELETE FROM ${from}`);
|
|
5381
5381
|
if (from !== quotedAs) {
|
|
5382
|
-
ctx.sql.push(
|
|
5382
|
+
ctx.sql.push(quotedAs);
|
|
5383
5383
|
}
|
|
5384
5384
|
let conditions;
|
|
5385
5385
|
if (query.join?.length) {
|
|
@@ -5868,7 +5868,7 @@ const processJoinItem = (ctx, table, query, args, quotedAs) => {
|
|
|
5868
5868
|
const as = j.q.as;
|
|
5869
5869
|
const joinAs = `"${as}"`;
|
|
5870
5870
|
if (as !== tableName) {
|
|
5871
|
-
target += `
|
|
5871
|
+
target += ` ${joinAs}`;
|
|
5872
5872
|
}
|
|
5873
5873
|
if (r && s) {
|
|
5874
5874
|
target = `LATERAL ${subJoinToSql(ctx, j, quotedTable, joinAs, true)}`;
|
|
@@ -5963,7 +5963,7 @@ const getArgQueryTarget = (ctx, first, joinSubQuery, cloned) => {
|
|
|
5963
5963
|
let target = quotedFrom || quoteSchemaAndTable(joinQuery.schema, first.table);
|
|
5964
5964
|
if (addAs) {
|
|
5965
5965
|
joinAs = qAs;
|
|
5966
|
-
target += `
|
|
5966
|
+
target += ` ${qAs}`;
|
|
5967
5967
|
}
|
|
5968
5968
|
return { target, joinAs };
|
|
5969
5969
|
}
|
|
@@ -12747,7 +12747,7 @@ class Db extends QueryMethods {
|
|
|
12747
12747
|
const column = shape[key];
|
|
12748
12748
|
if (!column.data.explicitSelect) {
|
|
12749
12749
|
list.push(
|
|
12750
|
-
column.data.name ? `"${column.data.name}"
|
|
12750
|
+
column.data.name ? `"${column.data.name}" "${key}"` : `"${key}"`
|
|
12751
12751
|
);
|
|
12752
12752
|
keys[key] = column;
|
|
12753
12753
|
}
|