Skip to content

Commit

Permalink
Merge pull request #315 from KxSystems/KXI-46574
Browse files Browse the repository at this point in the history
KXI-46574: Regression: Datasource double error message
  • Loading branch information
ecmel authored May 23, 2024
2 parents 0aa5588 + 03201cf commit e00d7bc
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions src/commands/dataSourceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,35 +152,37 @@ export async function runDataSource(
}

ext.isDatasourceExecution = false;
if (res.error) {
window.showErrorMessage(res.error);
addDStoQueryHistory(dataSourceForm, false, connLabel, executorName);
} else if (ext.resultsViewProvider.isVisible()) {
ext.outputChannel.appendLine(
`Results: ${typeof res === "string" ? "0" : res.rows.length} rows`,
);
addDStoQueryHistory(dataSourceForm, true, connLabel, executorName);
writeQueryResultsToView(
res,
getQuery(fileContent, selectedType),
connLabel,
executorName,
true,
selectedType,
);
} else {
ext.outputChannel.appendLine(
`Results is a string with length: ${res.length}`,
);
addDStoQueryHistory(dataSourceForm, true, connLabel, executorName);
writeQueryResultsToConsole(
res,
getQuery(fileContent, selectedType),
connLabel,
executorName,
true,
selectedType,
);
if (res) {
const success = !res.error;
const query = getQuery(fileContent, selectedType);

if (!success) {
window.showErrorMessage(res.error);
} else if (ext.resultsViewProvider.isVisible()) {
const resultCount = typeof res === "string" ? "0" : res.rows.length;
ext.outputChannel.appendLine(`Results: ${resultCount} rows`);
writeQueryResultsToView(
res,
query,
connLabel,
executorName,
true,
selectedType,
);
} else {
ext.outputChannel.appendLine(
`Results is a string with length: ${res.length}`,
);
writeQueryResultsToConsole(
res,
query,
connLabel,
executorName,
true,
selectedType,
);
}
addDStoQueryHistory(dataSourceForm, success, connLabel, executorName);
}
} catch (error) {
window.showErrorMessage((error as Error).message);
Expand Down

0 comments on commit e00d7bc

Please sign in to comment.