Updates
This commit is contained in:
@@ -12,6 +12,7 @@ type Param = {
|
||||
tableName?: string;
|
||||
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
|
||||
useLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ export default async function apiGet({
|
||||
tableName,
|
||||
dbSchema,
|
||||
useLocal,
|
||||
debug,
|
||||
}: Param): Promise<import("../../../types").GetReturn> {
|
||||
if (
|
||||
typeof query == "string" &&
|
||||
@@ -45,6 +47,11 @@ export default async function apiGet({
|
||||
local: useLocal,
|
||||
});
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:result", result);
|
||||
console.log("apiGet:error", error);
|
||||
}
|
||||
|
||||
let tableSchema: DSQL_TableSchemaType | undefined;
|
||||
|
||||
if (dbSchema) {
|
||||
@@ -83,6 +90,10 @@ export default async function apiGet({
|
||||
message: error.message,
|
||||
});
|
||||
|
||||
if (debug) {
|
||||
console.log("apiGet:error", error.message);
|
||||
}
|
||||
|
||||
return {
|
||||
success: false,
|
||||
payload: null,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ export interface GetReqQueryObject {
|
||||
query: string;
|
||||
queryValues?: string;
|
||||
tableName?: string;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
export type DATASQUIREL_LoggedInUser = {
|
||||
|
||||
Reference in New Issue
Block a user