Updates
This commit is contained in:
@@ -55,6 +55,7 @@ export default async function apiPost({
|
||||
tableName,
|
||||
dbContext,
|
||||
forceLocal,
|
||||
debug,
|
||||
});
|
||||
|
||||
if (debug) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import encrypt from "../../dsql/encrypt";
|
||||
import connDbHandler from "../../../utils/db/conn-db-handler";
|
||||
import checkIfIsMaster from "../../../utils/check-if-is-master";
|
||||
import { DbContextsArray } from "./runQuery";
|
||||
import debugLog from "../../../utils/logging/debug-log";
|
||||
|
||||
type Param = {
|
||||
dbContext?: (typeof DbContextsArray)[number];
|
||||
@@ -20,6 +21,7 @@ type Param = {
|
||||
encryptionKey?: string;
|
||||
encryptionSalt?: string;
|
||||
forceLocal?: boolean;
|
||||
debug?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -38,6 +40,7 @@ export default async function addDbEntry({
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
forceLocal,
|
||||
debug,
|
||||
}: Param): Promise<any> {
|
||||
/**
|
||||
* Initialize variables
|
||||
@@ -46,6 +49,14 @@ export default async function addDbEntry({
|
||||
? true
|
||||
: checkIfIsMaster({ dbContext, dbFullName });
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: isMaster,
|
||||
addTime: true,
|
||||
label: "isMaster",
|
||||
});
|
||||
}
|
||||
|
||||
const DB_CONN = isMaster
|
||||
? global.DSQL_DB_CONN
|
||||
: global.DSQL_FULL_ACCESS_DB_CONN || global.DSQL_DB_CONN;
|
||||
@@ -208,6 +219,26 @@ export default async function addDbEntry({
|
||||
.join(",")})`;
|
||||
const queryValuesArray = insertValuesArray;
|
||||
|
||||
if (debug) {
|
||||
debugLog({
|
||||
log: DB_CONN,
|
||||
addTime: true,
|
||||
label: "DB_CONN",
|
||||
});
|
||||
|
||||
debugLog({
|
||||
log: query,
|
||||
addTime: true,
|
||||
label: "query",
|
||||
});
|
||||
|
||||
debugLog({
|
||||
log: queryValuesArray,
|
||||
addTime: true,
|
||||
label: "queryValuesArray",
|
||||
});
|
||||
}
|
||||
|
||||
const newInsert = await connDbHandler(DB_CONN, query, queryValuesArray);
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,6 +133,7 @@ export default async function runQuery({
|
||||
duplicateColumnName,
|
||||
duplicateColumnValue,
|
||||
tableSchema,
|
||||
debug,
|
||||
});
|
||||
|
||||
if (!result?.insertId) {
|
||||
|
||||
Reference in New Issue
Block a user