Updates
This commit is contained in:
parent
9ab5543c5c
commit
57f06a631f
@ -142,12 +142,13 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) {
|
||||
let countSqls = [];
|
||||
for (let i = 0; i < genObject.countSubQueries.length; i++) {
|
||||
const countSubQuery = genObject.countSubQueries[i];
|
||||
const tableAlias = countSubQuery.table_alias;
|
||||
let subQStr = `(SELECT COUNT(*)`;
|
||||
subQStr += ` FROM ${countSubQuery.table}`;
|
||||
subQStr += ` FROM ${countSubQuery.table}${tableAlias ? ` ${tableAlias}` : ""}`;
|
||||
subQStr += ` WHERE (`;
|
||||
for (let j = 0; j < countSubQuery.srcTrgMap.length; j++) {
|
||||
const csqSrc = countSubQuery.srcTrgMap[j];
|
||||
subQStr += ` ${countSubQuery.table}.${csqSrc.src}`;
|
||||
subQStr += ` ${tableAlias || countSubQuery.table}.${csqSrc.src}`;
|
||||
if (typeof csqSrc.trg == "string") {
|
||||
subQStr += ` = ?`;
|
||||
sqlSearhValues.push(csqSrc.trg);
|
||||
|
||||
2
dist/package-shared/types/index.d.ts
vendored
2
dist/package-shared/types/index.d.ts
vendored
@ -846,6 +846,8 @@ export type ServerQueryParamFullTextSearch<T extends {
|
||||
};
|
||||
export type ServerQueryParamsCount = {
|
||||
table: string;
|
||||
/** Alias for the Table From which the count is fetched */
|
||||
table_alias?: string;
|
||||
srcTrgMap: {
|
||||
src: string;
|
||||
trg: string | ServerQueryParamsCountSrcTrgMap;
|
||||
|
||||
@ -205,13 +205,21 @@ export default function sqlGenerator<
|
||||
|
||||
for (let i = 0; i < genObject.countSubQueries.length; i++) {
|
||||
const countSubQuery = genObject.countSubQueries[i];
|
||||
const tableAlias = countSubQuery.table_alias;
|
||||
|
||||
let subQStr = `(SELECT COUNT(*)`;
|
||||
subQStr += ` FROM ${countSubQuery.table}`;
|
||||
|
||||
subQStr += ` FROM ${countSubQuery.table}${
|
||||
tableAlias ? ` ${tableAlias}` : ""
|
||||
}`;
|
||||
|
||||
subQStr += ` WHERE (`;
|
||||
|
||||
for (let j = 0; j < countSubQuery.srcTrgMap.length; j++) {
|
||||
const csqSrc = countSubQuery.srcTrgMap[j];
|
||||
subQStr += ` ${countSubQuery.table}.${csqSrc.src}`;
|
||||
subQStr += ` ${tableAlias || countSubQuery.table}.${
|
||||
csqSrc.src
|
||||
}`;
|
||||
|
||||
if (typeof csqSrc.trg == "string") {
|
||||
subQStr += ` = ?`;
|
||||
|
||||
@ -1035,6 +1035,8 @@ export type ServerQueryParamFullTextSearch<
|
||||
|
||||
export type ServerQueryParamsCount = {
|
||||
table: string;
|
||||
/** Alias for the Table From which the count is fetched */
|
||||
table_alias?: string;
|
||||
srcTrgMap: {
|
||||
src: string;
|
||||
trg: string | ServerQueryParamsCountSrcTrgMap;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "5.5.0",
|
||||
"version": "5.5.1",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user