mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 07:36:01 +00:00
feat: offsetFirstSkipRangeSyntax support
This commit is contained in:
@@ -12,6 +12,9 @@ export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) {
|
|||||||
if (cmd.topRecords) {
|
if (cmd.topRecords) {
|
||||||
if (!dmp.dialect.rangeSelect || dmp.dialect.offsetFetchRangeSyntax) dmp.put('^top %s ', cmd.topRecords);
|
if (!dmp.dialect.rangeSelect || dmp.dialect.offsetFetchRangeSyntax) dmp.put('^top %s ', cmd.topRecords);
|
||||||
}
|
}
|
||||||
|
if (cmd.range && dmp.dialect.offsetFirstSkipSyntax) {
|
||||||
|
dmp.put('^first %s ^skip %s ', cmd.range.limit, cmd.range.offset);
|
||||||
|
}
|
||||||
if (cmd.selectAll) {
|
if (cmd.selectAll) {
|
||||||
dmp.put('* ');
|
dmp.put('* ');
|
||||||
}
|
}
|
||||||
@@ -52,6 +55,8 @@ export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) {
|
|||||||
if (cmd.range) {
|
if (cmd.range) {
|
||||||
if (dmp.dialect.offsetFetchRangeSyntax) {
|
if (dmp.dialect.offsetFetchRangeSyntax) {
|
||||||
dmp.put('^offset %s ^rows ^fetch ^next %s ^rows ^only', cmd.range.offset, cmd.range.limit);
|
dmp.put('^offset %s ^rows ^fetch ^next %s ^rows ^only', cmd.range.offset, cmd.range.limit);
|
||||||
|
} else if (dmp.dialect.offsetFirstSkipSyntax) {
|
||||||
|
//
|
||||||
} else if (dmp.dialect.offsetNotSupported) {
|
} else if (dmp.dialect.offsetNotSupported) {
|
||||||
dmp.put('^limit %s', cmd.range.limit + cmd.range.offset);
|
dmp.put('^limit %s', cmd.range.limit + cmd.range.offset);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
1
packages/types/dialect.d.ts
vendored
1
packages/types/dialect.d.ts
vendored
@@ -8,6 +8,7 @@ export interface SqlDialect {
|
|||||||
topRecords?: boolean;
|
topRecords?: boolean;
|
||||||
stringEscapeChar: string;
|
stringEscapeChar: string;
|
||||||
offsetFetchRangeSyntax?: boolean;
|
offsetFetchRangeSyntax?: boolean;
|
||||||
|
offsetFirstSkipSyntax?: boolean;
|
||||||
offsetNotSupported?: boolean;
|
offsetNotSupported?: boolean;
|
||||||
quoteIdentifier(s: string): string;
|
quoteIdentifier(s: string): string;
|
||||||
fallbackDataType?: string;
|
fallbackDataType?: string;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ const dialect = {
|
|||||||
anonymousPrimaryKey: false,
|
anonymousPrimaryKey: false,
|
||||||
enableConstraintsPerTable: true,
|
enableConstraintsPerTable: true,
|
||||||
stringAgg: true,
|
stringAgg: true,
|
||||||
|
offsetFirstSkipSyntax: true,
|
||||||
|
|
||||||
quoteIdentifier(s) {
|
quoteIdentifier(s) {
|
||||||
return `"${s}"`;
|
return `"${s}"`;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user