This commit is contained in:
Benjamin Toby
2025-01-15 21:51:05 +01:00
parent 785b15aad5
commit e13a14ab5c
12 changed files with 83 additions and 12 deletions
@@ -12,6 +12,7 @@ type Param = {
query: string | any;
readOnly?: boolean;
local?: boolean;
debug?: boolean;
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
queryValuesArray?: (string | number)[];
tableName?: string;
@@ -28,6 +29,7 @@ export default async function runQuery({
queryValuesArray,
tableName,
local,
debug,
}: Param): Promise<any> {
/**
* Declare variables
@@ -66,6 +68,10 @@ export default async function runQuery({
if (typeof query === "string") {
const formattedQuery = trimSql(query);
if (debug) {
console.log("runQuery:formattedQuery", formattedQuery);
}
/**
* Input Validation
*
@@ -167,11 +173,16 @@ export default async function runQuery({
break;
}
}
} catch (/** @type {any} */ error: any) {
} catch (error: any) {
serverError({
component: "functions/backend/runQuery",
message: error.message,
});
if (debug) {
console.log("runQuery:error", error.message);
}
result = null;
error = error.message;
}