Cancel script execution after first error #1070

This commit is contained in:
SPRINX0\prochazka
2025-04-29 14:05:13 +02:00
parent ca7ca9da81
commit 8961ea6fc9
3 changed files with 24 additions and 12 deletions

View File

@@ -138,18 +138,23 @@ async function handleExecuteQuery({ sql, autoCommit }) {
executingScripts++;
try {
const resultIndexHolder = {
value: 0,
const queryStreamInfoHolder = {
resultIndex: 0,
canceled: false,
};
for (const sqlItem of splitQuery(sql, {
...driver.getQuerySplitterOptions('stream'),
returnRichInfo: true,
})) {
await handleQueryStream(dbhan, driver, resultIndexHolder, sqlItem);
await handleQueryStream(dbhan, driver, queryStreamInfoHolder, sqlItem);
// const handler = new StreamHandler(resultIndex);
// const stream = await driver.stream(systemConnection, sqlItem, handler);
// handler.stream = stream;
// resultIndex = handler.resultIndex;
if (queryStreamInfoHolder.canceled) {
break;
}
}
process.send({ msgtype: 'done', autoCommit });
} finally {