Add string query Formatter
This commit is contained in:
parent
6056646122
commit
5d56d41624
@ -89,9 +89,14 @@ async function runQuery({
|
|||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
if (typeof query === "string") {
|
if (typeof query === "string") {
|
||||||
|
const formattedQuery = query
|
||||||
|
.replace(/\n|\r|\n\r|\r\n/gm, " ")
|
||||||
|
.replace(/ {2,}/g, " ")
|
||||||
|
.trim();
|
||||||
|
|
||||||
if (local) {
|
if (local) {
|
||||||
const rawResults = await LOCAL_DB_HANDLER(
|
const rawResults = await LOCAL_DB_HANDLER(
|
||||||
query,
|
formattedQuery,
|
||||||
queryValuesArray
|
queryValuesArray
|
||||||
);
|
);
|
||||||
result = tableSchema
|
result = tableSchema
|
||||||
@ -102,14 +107,14 @@ async function runQuery({
|
|||||||
: rawResults;
|
: rawResults;
|
||||||
} else if (readOnly) {
|
} else if (readOnly) {
|
||||||
result = await varReadOnlyDatabaseDbHandler({
|
result = await varReadOnlyDatabaseDbHandler({
|
||||||
queryString: query,
|
queryString: formattedQuery,
|
||||||
queryValuesArray,
|
queryValuesArray,
|
||||||
database: dbFullName,
|
database: dbFullName,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result = await fullAccessDbHandler({
|
result = await fullAccessDbHandler({
|
||||||
queryString: query,
|
queryString: formattedQuery,
|
||||||
queryValuesArray,
|
queryValuesArray,
|
||||||
database: dbFullName,
|
database: dbFullName,
|
||||||
tableSchema,
|
tableSchema,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/datasquirel",
|
"name": "@moduletrace/datasquirel",
|
||||||
"version": "2.6.8",
|
"version": "2.6.9",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
Loading…
Reference in New Issue
Block a user