Shell: Run script

This commit is contained in:
SPRINX0\prochazka
2025-05-13 09:51:00 +02:00
parent 861ea7ef94
commit 2b101844e9
2 changed files with 34 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ const logger = getLogger('execQuery');
* @param {string} [options.sql] - SQL query
* @param {string} [options.sqlFile] - SQL file
* @param {boolean} [options.logScriptItems] - whether to log script items instead of whole script
* @param {boolean} [options.skipLogging] - whether to skip logging
*/
async function executeQuery({
connection = undefined,
@@ -22,8 +23,9 @@ async function executeQuery({
sql,
sqlFile = undefined,
logScriptItems = false,
skipLogging = false,
}) {
if (!logScriptItems) {
if (!logScriptItems && !skipLogging) {
logger.info({ sql: getLimitedQuery(sql) }, `Execute query`);
}
@@ -36,7 +38,9 @@ async function executeQuery({
}
try {
logger.debug(`Running SQL query, length: ${sql.length}`);
if (!skipLogging) {
logger.debug(`Running SQL query, length: ${sql.length}`);
}
await driver.script(dbhan, sql, { logScriptItems });
} finally {