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: [
|
columns: [
|
||||||
...select.columns,
|
...select.columns,
|
||||||
{
|
{
|
||||||
alias: '_rowNumber',
|
alias: '_RowNumber',
|
||||||
exprType: 'rowNumber',
|
exprType: 'rowNumber',
|
||||||
orderBy: select.orderBy
|
orderBy: select.orderBy
|
||||||
? select.orderBy.map(x =>
|
? select.orderBy.map(x =>
|
||||||
@ -683,7 +683,7 @@ export abstract class GridDisplay {
|
|||||||
let select = this.createSelect();
|
let select = this.createSelect();
|
||||||
if (!select) return null;
|
if (!select) return null;
|
||||||
if (this.dialect.rangeSelect) select.range = { offset: offset, limit: count };
|
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);
|
select = this.getRowNumberOverSelect(select, offset, count);
|
||||||
else if (this.dialect.limitSelect) select.topRecords = count;
|
else if (this.dialect.limitSelect) select.topRecords = count;
|
||||||
return select;
|
return select;
|
||||||
|
@ -8,6 +8,7 @@ import { detectSqlFilterBehaviour } from './detectSqlFilterBehaviour';
|
|||||||
const dialect = {
|
const dialect = {
|
||||||
limitSelect: true,
|
limitSelect: true,
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
|
topRecords: false,
|
||||||
offsetFetchRangeSyntax: true,
|
offsetFetchRangeSyntax: true,
|
||||||
stringEscapeChar: "'",
|
stringEscapeChar: "'",
|
||||||
fallbackDataType: 'nvarchar(max)',
|
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;
|
limitSelect?: boolean;
|
||||||
ilike?: boolean;
|
ilike?: boolean;
|
||||||
rowNumberOverPaging?: boolean;
|
rowNumberOverPaging?: boolean;
|
||||||
|
topRecords?: boolean;
|
||||||
stringEscapeChar: string;
|
stringEscapeChar: string;
|
||||||
offsetFetchRangeSyntax?: boolean;
|
offsetFetchRangeSyntax?: boolean;
|
||||||
quoteIdentifier(s: string): string;
|
quoteIdentifier(s: string): string;
|
||||||
|
@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
|
|||||||
const dialect = {
|
const dialect = {
|
||||||
limitSelect: true,
|
limitSelect: true,
|
||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
|
topRecords: true,
|
||||||
offsetFetchRangeSyntax: true,
|
offsetFetchRangeSyntax: true,
|
||||||
rowNumberOverPaging: true,
|
rowNumberOverPaging: true,
|
||||||
defaultSchemaName: 'dbo',
|
defaultSchemaName: 'dbo',
|
||||||
|
@ -255,7 +255,7 @@ const driver = {
|
|||||||
// const { rows } = await this.query(client, 'SELECT version as "version" FROM v$instance');
|
// const { rows } = await this.query(client, 'SELECT version as "version" FROM v$instance');
|
||||||
const version = await this.getVersionCore(client);
|
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);
|
//console.log('M', m);
|
||||||
let versionText = null;
|
let versionText = null;
|
||||||
let versionMajor = null;
|
let versionMajor = null;
|
||||||
|
@ -9,6 +9,7 @@ const dialect = {
|
|||||||
rangeSelect: true,
|
rangeSelect: true,
|
||||||
limitSelect: false,
|
limitSelect: false,
|
||||||
offsetFetchRangeSyntax: true,
|
offsetFetchRangeSyntax: true,
|
||||||
|
rowNumberOverPaging: true,
|
||||||
ilike: true,
|
ilike: true,
|
||||||
// stringEscapeChar: '\\',
|
// stringEscapeChar: '\\',
|
||||||
stringEscapeChar: "'",
|
stringEscapeChar: "'",
|
||||||
@ -151,6 +152,17 @@ $$ LANGUAGE plpgsql;`,
|
|||||||
},
|
},
|
||||||
|
|
||||||
showConnectionTab: field => field == 'sshTunnel',
|
showConnectionTab: field => field == 'sshTunnel',
|
||||||
|
|
||||||
|
dialectByVersion(version) {
|
||||||
|
if (version && version.versionMajor < 12) {
|
||||||
|
return {
|
||||||
|
...dialect,
|
||||||
|
rangeSelect: false,
|
||||||
|
offsetFetchRangeSyntax: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return dialect;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = oracleDriver;
|
module.exports = oracleDriver;
|
||||||
|
Loading…
Reference in New Issue
Block a user