mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
support range select for oracle <12
This commit is contained in:
parent
f0f9be3051
commit
880b07a328
@ -625,7 +625,7 @@ export abstract class GridDisplay {
|
||||
columns: [
|
||||
...select.columns,
|
||||
{
|
||||
alias: '_rowNumber',
|
||||
alias: '_RowNumber',
|
||||
exprType: 'rowNumber',
|
||||
orderBy: select.orderBy
|
||||
? select.orderBy.map(x =>
|
||||
@ -683,7 +683,7 @@ export abstract class GridDisplay {
|
||||
let select = this.createSelect();
|
||||
if (!select) return null;
|
||||
if (this.dialect.rangeSelect) select.range = { offset: offset, limit: count };
|
||||
else if (this.dialect.rowNumberOverPaging && offset > 0)
|
||||
else if (this.dialect.rowNumberOverPaging && (offset > 0 || !this.dialect.topRecords))
|
||||
select = this.getRowNumberOverSelect(select, offset, count);
|
||||
else if (this.dialect.limitSelect) select.topRecords = count;
|
||||
return select;
|
||||
|
@ -8,6 +8,7 @@ import { detectSqlFilterBehaviour } from './detectSqlFilterBehaviour';
|
||||
const dialect = {
|
||||
limitSelect: true,
|
||||
rangeSelect: true,
|
||||
topRecords: false,
|
||||
offsetFetchRangeSyntax: true,
|
||||
stringEscapeChar: "'",
|
||||
fallbackDataType: 'nvarchar(max)',
|
||||
|
1
packages/types/dialect.d.ts
vendored
1
packages/types/dialect.d.ts
vendored
@ -3,6 +3,7 @@ export interface SqlDialect {
|
||||
limitSelect?: boolean;
|
||||
ilike?: boolean;
|
||||
rowNumberOverPaging?: boolean;
|
||||
topRecords?: boolean;
|
||||
stringEscapeChar: string;
|
||||
offsetFetchRangeSyntax?: boolean;
|
||||
quoteIdentifier(s: string): string;
|
||||
|
@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
|
||||
const dialect = {
|
||||
limitSelect: true,
|
||||
rangeSelect: true,
|
||||
topRecords: true,
|
||||
offsetFetchRangeSyntax: true,
|
||||
rowNumberOverPaging: true,
|
||||
defaultSchemaName: 'dbo',
|
||||
|
@ -255,7 +255,7 @@ const driver = {
|
||||
// const { rows } = await this.query(client, 'SELECT version as "version" FROM v$instance');
|
||||
const version = await this.getVersionCore(client);
|
||||
|
||||
const m = version.match(/(\d+[a-z])\s+(\w+).*(\d+)\.(\d+)/);
|
||||
const m = version.match(/(\d+[a-z]+)\s+(\w+).*?(\d+)\.(\d+)/);
|
||||
//console.log('M', m);
|
||||
let versionText = null;
|
||||
let versionMajor = null;
|
||||
|
@ -9,6 +9,7 @@ const dialect = {
|
||||
rangeSelect: true,
|
||||
limitSelect: false,
|
||||
offsetFetchRangeSyntax: true,
|
||||
rowNumberOverPaging: true,
|
||||
ilike: true,
|
||||
// stringEscapeChar: '\\',
|
||||
stringEscapeChar: "'",
|
||||
@ -151,6 +152,17 @@ $$ LANGUAGE plpgsql;`,
|
||||
},
|
||||
|
||||
showConnectionTab: field => field == 'sshTunnel',
|
||||
|
||||
dialectByVersion(version) {
|
||||
if (version && version.versionMajor < 12) {
|
||||
return {
|
||||
...dialect,
|
||||
rangeSelect: false,
|
||||
offsetFetchRangeSyntax: false,
|
||||
};
|
||||
}
|
||||
return dialect;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = oracleDriver;
|
||||
|
Loading…
Reference in New Issue
Block a user