support range select for oracle <12

This commit is contained in:
SPRINX0\prochazka 2024-09-05 13:13:58 +02:00
parent f0f9be3051
commit 880b07a328
6 changed files with 18 additions and 3 deletions

View File

@ -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;

View File

@ -8,6 +8,7 @@ import { detectSqlFilterBehaviour } from './detectSqlFilterBehaviour';
const dialect = {
limitSelect: true,
rangeSelect: true,
topRecords: false,
offsetFetchRangeSyntax: true,
stringEscapeChar: "'",
fallbackDataType: 'nvarchar(max)',

View File

@ -3,6 +3,7 @@ export interface SqlDialect {
limitSelect?: boolean;
ilike?: boolean;
rowNumberOverPaging?: boolean;
topRecords?: boolean;
stringEscapeChar: string;
offsetFetchRangeSyntax?: boolean;
quoteIdentifier(s: string): string;

View File

@ -8,6 +8,7 @@ const spatialTypes = ['GEOGRAPHY'];
const dialect = {
limitSelect: true,
rangeSelect: true,
topRecords: true,
offsetFetchRangeSyntax: true,
rowNumberOverPaging: true,
defaultSchemaName: 'dbo',

View File

@ -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;

View File

@ -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;