mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
oracle version getter
This commit is contained in:
parent
4e6e0a79c4
commit
d87af2a820
@ -209,11 +209,11 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
try {
|
try {
|
||||||
const { rows } = await this.query(
|
const { rows } = await this.query(
|
||||||
client,
|
client,
|
||||||
'SELECT version_full as "version" FROM product_component_version WHERE product LIKE \'Oracle%Database%\''
|
"SELECT product || ' ' || version_full as \"version\" FROM product_component_version WHERE product LIKE 'Oracle%Database%'"
|
||||||
);
|
);
|
||||||
return rows[0].version;
|
return rows[0].version.replace(' ', ' ');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const { rows } = await this.query(client, 'SELECT version as "version" FROM v$instance');
|
const { rows } = await this.query(client, 'SELECT banner as "version" FROM v$version');
|
||||||
return rows[0].version;
|
return rows[0].version;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -223,16 +223,15 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
// 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\.]+)/);
|
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;
|
||||||
let versionMinor = null;
|
let versionMinor = null;
|
||||||
if (m) {
|
if (m) {
|
||||||
versionText = `Oracle ${m[1]}`;
|
versionText = `Oracle ${m[1]} ${m[2]}`;
|
||||||
const numbers = m[1].split('.');
|
if (m[3]) versionMajor = parseInt(m[3]);
|
||||||
if (numbers[0]) versionMajor = parseInt(numbers[0]);
|
if (m[4]) versionMinor = parseInt(m[4]);
|
||||||
if (numbers[1]) versionMinor = parseInt(numbers[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -245,8 +244,8 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
return {
|
return {
|
||||||
version: '???',
|
version: '???',
|
||||||
versionText: 'Oracle ???',
|
versionText: 'Oracle ???',
|
||||||
versionMajor: 0,
|
versionMajor: null,
|
||||||
versionMinor: 0,
|
versionMinor: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user