Merge pull request #12960 from nocodb/nc-refactor/unified-query-list-read

unify single query list / read
This commit is contained in:
Pranav C
2026-01-28 18:41:41 +05:30
committed by GitHub
5 changed files with 31 additions and 1 deletions

View File

@@ -1,9 +1,17 @@
import { arrFlatMap } from 'nocodb-sdk';
import { arrFlatMap, ClientType } from 'nocodb-sdk';
import type { DBQueryClient } from '~/dbQueryClient/types';
import type { Knex, XKnex } from '~/db/CustomKnex';
import type { PagedResponseImpl } from '~/helpers/PagedResponse';
export abstract class GenericDBQueryClient implements DBQueryClient {
get clientType(): ClientType {
return ClientType.PG;
}
validateClientType(client: string) {
if (client !== this.clientType) {
throw new Error('Source is not ' + this.clientType);
}
}
temporaryTableRaw({
knex,
data,

View File

@@ -1,3 +1,4 @@
import { ClientType } from 'nocodb-sdk';
import type { DBQueryClient } from '~/dbQueryClient/types';
import { GenericDBQueryClient } from '~/dbQueryClient/generic';
@@ -5,6 +6,15 @@ export class MySqlDBQueryClient
extends GenericDBQueryClient
implements DBQueryClient
{
get clientType(): ClientType {
return ClientType.MYSQL;
}
validateClientType(client: string) {
if (!['mysql', 'mysql2'].includes(client)) {
throw new Error('Source is not ' + this.clientType);
}
}
concat(fields: string[]) {
return `CONCAT(${fields.join(', ')})`;
}

View File

@@ -1,3 +1,4 @@
import { ClientType } from 'nocodb-sdk';
import type { DBQueryClient } from '~/dbQueryClient/types';
import { GenericDBQueryClient } from '~/dbQueryClient/generic';
@@ -5,6 +6,10 @@ export class PGDBQueryClient
extends GenericDBQueryClient
implements DBQueryClient
{
get clientType(): ClientType {
return ClientType.PG;
}
concat(fields: string[]) {
return `CONCAT(${fields.join(', ')})`;
}

View File

@@ -1,3 +1,4 @@
import { ClientType } from 'nocodb-sdk';
import type { DBQueryClient } from '~/dbQueryClient/types';
import { GenericDBQueryClient } from '~/dbQueryClient/generic';
@@ -5,6 +6,9 @@ export class SqliteDBQueryClient
extends GenericDBQueryClient
implements DBQueryClient
{
get clientType(): ClientType {
return ClientType.SQLITE;
}
concat(fields: string[]) {
return `${fields.join(' || ')}`;
}

View File

@@ -1,6 +1,9 @@
import type { ClientType } from 'nocodb-sdk';
import type { Knex, XKnex } from '~/db/CustomKnex';
export interface DBQueryClient {
get clientType(): ClientType;
validateClientType(client: string): void;
temporaryTable(payload: {
data: Record<string, any>[];
fields: string[];