diff --git a/package-shared/functions/backend/db/runQuery.js b/package-shared/functions/backend/db/runQuery.js index b90d2dc..a5b23e5 100644 --- a/package-shared/functions/backend/db/runQuery.js +++ b/package-shared/functions/backend/db/runQuery.js @@ -89,9 +89,14 @@ async function runQuery({ */ try { if (typeof query === "string") { + const formattedQuery = query + .replace(/\n|\r|\n\r|\r\n/gm, " ") + .replace(/ {2,}/g, " ") + .trim(); + if (local) { const rawResults = await LOCAL_DB_HANDLER( - query, + formattedQuery, queryValuesArray ); result = tableSchema @@ -102,14 +107,14 @@ async function runQuery({ : rawResults; } else if (readOnly) { result = await varReadOnlyDatabaseDbHandler({ - queryString: query, + queryString: formattedQuery, queryValuesArray, database: dbFullName, tableSchema, }); } else { result = await fullAccessDbHandler({ - queryString: query, + queryString: formattedQuery, queryValuesArray, database: dbFullName, tableSchema, diff --git a/package.json b/package.json index c5a6be6..2bf4a82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "2.6.8", + "version": "2.6.9", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": {