mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
SYNC: View PostgreSQL server output #1108
This commit is contained in:
committed by
Diflow
parent
a4518ce261
commit
36ae07074d
@@ -164,6 +164,16 @@ const drivers = driverBases.map(driverBase => ({
|
||||
return { rows: (res.rows || []).map(row => zipDataRow(row, columns)), columns };
|
||||
},
|
||||
stream(dbhan, sql, options) {
|
||||
const handleNotice = notice => {
|
||||
const { message, where } = notice;
|
||||
options.info({
|
||||
message,
|
||||
procedure: where,
|
||||
time: new Date(),
|
||||
severity: 'info',
|
||||
});
|
||||
};
|
||||
|
||||
const query = new pg.Query({
|
||||
text: sql,
|
||||
rowMode: 'array',
|
||||
@@ -171,6 +181,7 @@ const drivers = driverBases.map(driverBase => ({
|
||||
|
||||
let wasHeader = false;
|
||||
let columnsToTransform = null;
|
||||
dbhan.client.on('notice', handleNotice);
|
||||
|
||||
query.on('row', row => {
|
||||
if (!wasHeader) {
|
||||
@@ -211,6 +222,7 @@ const drivers = driverBases.map(driverBase => ({
|
||||
wasHeader = true;
|
||||
}
|
||||
|
||||
dbhan.client.off('notice', handleNotice);
|
||||
options.done();
|
||||
});
|
||||
|
||||
@@ -228,6 +240,7 @@ const drivers = driverBases.map(driverBase => ({
|
||||
time: new Date(),
|
||||
severity: 'error',
|
||||
});
|
||||
dbhan.client.off('notice', handleNotice);
|
||||
options.done();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user