From 3d6f051a7d6c39b4e7d2fae0cd03140da1b70d6d Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Mon, 17 Oct 2022 22:49:45 -0400 Subject: [PATCH] fix(striker-ui-api): output SQL query when debug --- striker-ui-api/src/lib/accessModule.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/striker-ui-api/src/lib/accessModule.ts b/striker-ui-api/src/lib/accessModule.ts index 8216d31f..d42502a5 100644 --- a/striker-ui-api/src/lib/accessModule.ts +++ b/striker-ui-api/src/lib/accessModule.ts @@ -113,8 +113,12 @@ const dbJobAnvilSyncShared = ( return execModuleSubroutine('insert_or_update_jobs', { subParams }).stdout; }; -const dbQuery = (query: string, options?: SpawnSyncOptions) => - execAnvilAccessModule(['--query', query], options); +const dbQuery = (query: string, options?: SpawnSyncOptions) => { + // For printing SQL query to debug. + // process.stdout.write(`${query.replace(/\s+/g, ' ')}\n`); + + return execAnvilAccessModule(['--query', query], options); +}; const dbSubRefreshTimestamp = () => execModuleSubroutine('refresh_timestamp').stdout;