Bugfix
This commit is contained in:
@@ -19,6 +19,7 @@ type Param = {
|
||||
update?: boolean;
|
||||
encryptionKey?: string;
|
||||
encryptionSalt?: string;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -36,11 +37,14 @@ export default async function addDbEntry({
|
||||
update,
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
forceLocal,
|
||||
}: Param): Promise<any> {
|
||||
/**
|
||||
* Initialize variables
|
||||
*/
|
||||
const isMaster = checkIfIsMaster({ dbContext, dbFullName });
|
||||
const isMaster = forceLocal
|
||||
? true
|
||||
: checkIfIsMaster({ dbContext, dbFullName });
|
||||
|
||||
const DB_CONN = isMaster
|
||||
? global.DSQL_DB_CONN
|
||||
|
||||
@@ -9,6 +9,7 @@ type Param = {
|
||||
tableSchema?: import("../../../types").DSQL_TableSchemaType;
|
||||
identifierColumnName: string;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -21,9 +22,12 @@ export default async function deleteDbEntry({
|
||||
tableName,
|
||||
identifierColumnName,
|
||||
identifierValue,
|
||||
forceLocal,
|
||||
}: Param): Promise<object | null> {
|
||||
try {
|
||||
const isMaster = checkIfIsMaster({ dbContext, dbFullName });
|
||||
const isMaster = forceLocal
|
||||
? true
|
||||
: checkIfIsMaster({ dbContext, dbFullName });
|
||||
|
||||
const DB_CONN = isMaster
|
||||
? global.DSQL_DB_CONN
|
||||
|
||||
@@ -18,6 +18,7 @@ type Param = {
|
||||
dbSchema?: import("../../../types").DSQL_DatabaseSchemaType;
|
||||
queryValuesArray?: (string | number)[];
|
||||
tableName?: string;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
|
||||
type Return = {
|
||||
@@ -37,6 +38,7 @@ export default async function runQuery({
|
||||
tableName,
|
||||
debug,
|
||||
dbContext,
|
||||
forceLocal,
|
||||
}: Param): Promise<Return> {
|
||||
/**
|
||||
* Declare variables
|
||||
@@ -93,12 +95,14 @@ export default async function runQuery({
|
||||
queryString: formattedQuery,
|
||||
queryValuesArray: queryValuesArray?.map((vl) => String(vl)),
|
||||
tableSchema,
|
||||
forceLocal,
|
||||
});
|
||||
} else {
|
||||
result = await fullAccessDbHandler({
|
||||
queryString: formattedQuery,
|
||||
queryValuesArray: queryValuesArray?.map((vl) => String(vl)),
|
||||
tableSchema,
|
||||
forceLocal,
|
||||
});
|
||||
}
|
||||
} else if (typeof query === "object") {
|
||||
|
||||
@@ -15,6 +15,7 @@ type Param = {
|
||||
tableSchema?: import("../../../types").DSQL_TableSchemaType;
|
||||
identifierColumnName: string;
|
||||
identifierValue: string | number;
|
||||
forceLocal?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -31,13 +32,16 @@ export default async function updateDbEntry({
|
||||
identifierValue,
|
||||
encryptionKey,
|
||||
encryptionSalt,
|
||||
forceLocal,
|
||||
}: Param): Promise<object | null> {
|
||||
/**
|
||||
* Check if data is valid
|
||||
*/
|
||||
if (!data || !Object.keys(data).length) return null;
|
||||
|
||||
const isMaster = checkIfIsMaster({ dbContext, dbFullName });
|
||||
const isMaster = forceLocal
|
||||
? true
|
||||
: checkIfIsMaster({ dbContext, dbFullName });
|
||||
|
||||
const DB_CONN = isMaster
|
||||
? global.DSQL_DB_CONN
|
||||
|
||||
Reference in New Issue
Block a user