diff --git a/packages/sqltree/src/dumpSqlCommand.ts b/packages/sqltree/src/dumpSqlCommand.ts index 4122ea3f8..e8286bafb 100644 --- a/packages/sqltree/src/dumpSqlCommand.ts +++ b/packages/sqltree/src/dumpSqlCommand.ts @@ -12,6 +12,9 @@ export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) { if (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) { dmp.put('* '); } @@ -52,6 +55,8 @@ export function dumpSqlSelect(dmp: SqlDumper, cmd: Select) { if (cmd.range) { if (dmp.dialect.offsetFetchRangeSyntax) { 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) { dmp.put('^limit %s', cmd.range.limit + cmd.range.offset); } else { diff --git a/packages/types/dialect.d.ts b/packages/types/dialect.d.ts index 4e772be8e..53baf4a0b 100644 --- a/packages/types/dialect.d.ts +++ b/packages/types/dialect.d.ts @@ -8,6 +8,7 @@ export interface SqlDialect { topRecords?: boolean; stringEscapeChar: string; offsetFetchRangeSyntax?: boolean; + offsetFirstSkipSyntax?: boolean; offsetNotSupported?: boolean; quoteIdentifier(s: string): string; fallbackDataType?: string; diff --git a/plugins/dbgate-plugin-firebird/src/frontend/driver.js b/plugins/dbgate-plugin-firebird/src/frontend/driver.js index c4118e175..69d729dae 100644 --- a/plugins/dbgate-plugin-firebird/src/frontend/driver.js +++ b/plugins/dbgate-plugin-firebird/src/frontend/driver.js @@ -11,6 +11,8 @@ const dialect = { anonymousPrimaryKey: false, enableConstraintsPerTable: true, stringAgg: true, + offsetFirstSkipSyntax: true, + quoteIdentifier(s) { return `"${s}"`; },