Add string query Formatter

This commit is contained in:
Benjamin Toby 2024-11-18 10:47:14 +01:00
parent 6056646122
commit 5d56d41624
2 changed files with 9 additions and 4 deletions

View File

@ -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,

View File

@ -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": {