Updates
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@ type Param = {
|
||||
query: string | any;
|
||||
readOnly?: boolean;
|
||||
local?: boolean;
|
||||
debug?: boolean;
|
||||
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
|
||||
queryValuesArray?: (string | number)[];
|
||||
tableName?: string;
|
||||
@@ -10,5 +11,5 @@ type Param = {
|
||||
/**
|
||||
* # Run DSQL users queries
|
||||
*/
|
||||
export default function runQuery({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, local, }: Param): Promise<any>;
|
||||
export default function runQuery({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, local, debug, }: Param): Promise<any>;
|
||||
export {};
|
||||
|
||||
+8
-2
@@ -24,7 +24,7 @@ const trim_sql_1 = __importDefault(require("../../../utils/trim-sql"));
|
||||
* # Run DSQL users queries
|
||||
*/
|
||||
function runQuery(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, local, }) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ dbFullName, query, readOnly, dbSchema, queryValuesArray, tableName, local, debug, }) {
|
||||
/**
|
||||
* Declare variables
|
||||
*
|
||||
@@ -58,6 +58,9 @@ function runQuery(_a) {
|
||||
try {
|
||||
if (typeof query === "string") {
|
||||
const formattedQuery = (0, trim_sql_1.default)(query);
|
||||
if (debug) {
|
||||
console.log("runQuery:formattedQuery", formattedQuery);
|
||||
}
|
||||
/**
|
||||
* Input Validation
|
||||
*
|
||||
@@ -140,11 +143,14 @@ function runQuery(_a) {
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( /** @type {any} */error) {
|
||||
catch (error) {
|
||||
(0, serverError_1.default)({
|
||||
component: "functions/backend/runQuery",
|
||||
message: error.message,
|
||||
});
|
||||
if (debug) {
|
||||
console.log("runQuery:error", error.message);
|
||||
}
|
||||
result = null;
|
||||
error = error.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user