mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 16:23:58 +00:00
oracle analyser per schema
This commit is contained in:
@@ -61,6 +61,7 @@ function getPortalCollections() {
|
||||
useDatabaseUrl: !!process.env[`URL_${id}`],
|
||||
databaseFile: process.env[`FILE_${id}`],
|
||||
socketPath: process.env[`SOCKET_PATH_${id}`],
|
||||
serviceName: process.env[`SERVICE_NAME_${id}`],
|
||||
authType: process.env[`AUTH_TYPE_${id}`] || (process.env[`SOCKET_PATH_${id}`] ? 'socket' : undefined),
|
||||
defaultDatabase:
|
||||
process.env[`DATABASE_${id}`] ||
|
||||
|
||||
@@ -180,8 +180,15 @@ export class DatabaseAnalyser {
|
||||
// return this.createQueryCore('=OBJECT_ID_CONDITION', typeFields) != ' is not null';
|
||||
// }
|
||||
|
||||
createQuery(template, typeFields) {
|
||||
return this.createQueryCore(template, typeFields);
|
||||
createQuery(template, typeFields, replacements = {}) {
|
||||
return this.createQueryCore(this.processQueryReplacements(template, replacements), typeFields);
|
||||
}
|
||||
|
||||
processQueryReplacements(query, replacements) {
|
||||
for (const repl in replacements) {
|
||||
query = query.replaceAll(repl, replacements[repl]);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
createQueryCore(template, typeFields) {
|
||||
@@ -302,8 +309,8 @@ export class DatabaseAnalyser {
|
||||
return [..._compact(res), ...this.getDeletedObjects(snapshot)];
|
||||
}
|
||||
|
||||
async analyserQuery(template, typeFields) {
|
||||
const sql = this.createQuery(template, typeFields);
|
||||
async analyserQuery(template, typeFields, replacements = {}) {
|
||||
const sql = this.createQuery(template, typeFields, replacements);
|
||||
|
||||
if (!sql) {
|
||||
return {
|
||||
@@ -311,7 +318,9 @@ export class DatabaseAnalyser {
|
||||
};
|
||||
}
|
||||
try {
|
||||
return await this.driver.query(this.pool, sql);
|
||||
const res = await this.driver.query(this.pool, sql);
|
||||
this.logger.debug({ rows: res.rows.length, template }, `Loaded analyser query`);
|
||||
return res;
|
||||
} catch (err) {
|
||||
logger.error({ err }, 'Error running analyser query');
|
||||
return {
|
||||
|
||||
@@ -123,6 +123,10 @@
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if driver?.showConnectionField('serviceName', $values)}
|
||||
<FormTextField label="Service name" name="serviceName" disabled={isConnected} />
|
||||
{/if}
|
||||
|
||||
{#if driver?.showConnectionField('socketPath', $values)}
|
||||
<FormTextField
|
||||
label="Socket path"
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
'defaultDatabase',
|
||||
'singleDatabase',
|
||||
'socketPath',
|
||||
'serviceName',
|
||||
];
|
||||
const visibleProps = allProps.filter(x => driver?.showConnectionField(x, $values));
|
||||
const omitProps = _.difference(allProps, visibleProps);
|
||||
|
||||
@@ -24,6 +24,9 @@ function getConnectionLabelCore(connection, { allowExplicitDatabase = true } = {
|
||||
if (connection.singleDatabase && connection.defaultDatabase) {
|
||||
return `${connection.defaultDatabase}`;
|
||||
}
|
||||
if (connection.useDatabaseUrl) {
|
||||
return `${connection.databaseUrl}`;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user