SYNC: Merge branch 'feature/dblogs'

This commit is contained in:
SPRINX0\prochazka
2025-08-06 12:34:25 +02:00
committed by Diflow
parent 4ed437fd4e
commit ed7605eccd
15 changed files with 241 additions and 153 deletions

View File

@@ -96,6 +96,7 @@ const driver = {
client,
connectionType,
database: conn.database,
conid: conn.conid,
};
},
async close(dbhan) {

View File

@@ -34,7 +34,8 @@ const drivers = driverBases.map(driverBase => ({
analyserClass: Analyser,
async connect(props) {
const { server, port, user, password, database, ssl, isReadOnly, forceRowsAsObjects, socketPath, authType } = props;
const { conid, server, port, user, password, database, ssl, isReadOnly, forceRowsAsObjects, socketPath, authType } =
props;
let awsIamToken = null;
if (authType == 'awsIam') {
awsIamToken = await authProxy.getAwsIamToken(props);
@@ -60,6 +61,7 @@ const drivers = driverBases.map(driverBase => ({
const dbhan = {
client,
database,
conid,
};
if (isReadOnly) {
await this.query(dbhan, 'SET SESSION TRANSACTION READ ONLY');
@@ -138,7 +140,7 @@ const drivers = driverBases.map(driverBase => ({
};
const handleError = error => {
logger.error(extractErrorLogData(error), 'DBGM-00200 Stream error');
logger.error(extractErrorLogData(error, this.getLogDbInfo(dbhan)), 'DBGM-00200 Stream error');
const { message } = error;
options.info({
message,

View File

@@ -78,6 +78,7 @@ const drivers = driverBases.map(driverBase => ({
async connect(props) {
const {
conid,
engine,
server,
port,
@@ -137,6 +138,7 @@ const drivers = driverBases.map(driverBase => ({
const dbhan = {
client,
database,
conid,
};
const datatypes = await this.query(dbhan, `SELECT oid, typname FROM pg_type WHERE typname in ('geography')`);
@@ -228,7 +230,7 @@ const drivers = driverBases.map(driverBase => ({
});
query.on('error', error => {
logger.error(extractErrorLogData(error), 'DBGM-00201 Stream error');
logger.error(extractErrorLogData(error, this.getLogDbInfo(dbhan)), 'DBGM-00201 Stream error');
const { message, position, procName } = error;
let line = null;
if (position) {
@@ -382,7 +384,7 @@ const drivers = driverBases.map(driverBase => ({
const defaultSchemaRows = await this.query(dbhan, 'SELECT current_schema');
const defaultSchema = defaultSchemaRows.rows[0]?.current_schema?.trim();
logger.debug(`DBGM-00142 Loaded ${schemaRows.rows.length} postgres schemas`);
logger.debug(this.getLogDbInfo(dbhan), `DBGM-00142 Loaded ${schemaRows.rows.length} postgres schemas`);
const schemas = schemaRows.rows.map(x => ({
schemaName: x.schema_name,