mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
oracle: handle statements in stream
This commit is contained in:
parent
0cc7a98391
commit
ca0ae2084c
@ -98,6 +98,8 @@ const drivers = driverBases.map(driverBase => ({
|
||||
});
|
||||
*/
|
||||
// console.log('queryStream', sql);
|
||||
|
||||
if (sql.trim().toLowerCase().startsWith('select')) {
|
||||
const query = client.queryStream(sql);
|
||||
// const consumeStream = new Promise((resolve, reject) => {
|
||||
let rowcount = 0;
|
||||
@ -169,7 +171,35 @@ const drivers = driverBases.map(driverBase => ({
|
||||
//resolve(rowcount);
|
||||
});
|
||||
//});
|
||||
} else {
|
||||
client.execute(sql, (err, res) => {
|
||||
if (err) {
|
||||
console.log('Error query', err, sql);
|
||||
options.info({
|
||||
message: err.message,
|
||||
time: new Date(),
|
||||
severity: 'error',
|
||||
});
|
||||
} else {
|
||||
const { rowsAffected, metaData, rows } = res || {};
|
||||
|
||||
if (rows && metaData) {
|
||||
const columns = extractOracleColumns(metaData);
|
||||
options.recordset(columns);
|
||||
for (const row of rows) {
|
||||
options.row(zipDataRow(row, columns));
|
||||
}
|
||||
} else if (rowsAffected) {
|
||||
options.info({
|
||||
message: `${rowsAffected} rows affected`,
|
||||
time: new Date(),
|
||||
severity: 'info',
|
||||
});
|
||||
}
|
||||
}
|
||||
options.done();
|
||||
});
|
||||
}
|
||||
//const numrows = await consumeStream;
|
||||
//console.log('Rows selected: ' + numrows);
|
||||
//client.query(query);
|
||||
|
Loading…
Reference in New Issue
Block a user