updates
This commit is contained in:
@@ -30,7 +30,7 @@ const updateDb = require("./updateDb");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function add({ dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Initialize variables
|
||||
*/
|
||||
@@ -133,6 +133,9 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
|
||||
const query = `INSERT INTO \`${tableName}\` (${insertKeysArray.join(",")}) VALUES (${insertValuesArray.map(() => "?").join(",")})`;
|
||||
const queryValuesArray = insertValuesArray;
|
||||
|
||||
console.log("DSQL: Query =>", query);
|
||||
console.log("DSQL: Query Values =>", queryValuesArray);
|
||||
|
||||
const newInsert = await handler({
|
||||
queryString: query,
|
||||
database: dbFullName,
|
||||
@@ -153,4 +156,10 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
|
||||
* Return statement
|
||||
*/
|
||||
return newInsert;
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = addDb;
|
||||
@@ -24,7 +24,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function deleteDb({ dbFullName, tableName, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function deleteDb({ dbFullName, tableName, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
try {
|
||||
/**
|
||||
* Check if data is valid
|
||||
@@ -71,4 +71,10 @@ module.exports = async function deleteDb({ dbFullName, tableName, identifierColu
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = deleteDb;
|
||||
|
||||
+8
-2
@@ -19,7 +19,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function query({ dbFullName, dbHost, dbPassword, dbUsername, query }) {
|
||||
async function query({ dbFullName, dbHost, dbPassword, dbUsername, query }) {
|
||||
/**
|
||||
* Initialize variables
|
||||
*/
|
||||
@@ -74,4 +74,10 @@ module.exports = async function query({ dbFullName, dbHost, dbPassword, dbUserna
|
||||
console.log("\x1b[31mDSQL RAW Database Handler No results returned\x1b[0m =>", results);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = query;
|
||||
|
||||
@@ -25,7 +25,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function updateDb({ dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function updateDb({ dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Check if data is valid
|
||||
*/
|
||||
@@ -89,4 +89,10 @@ module.exports = async function updateDb({ dbFullName, tableName, data, tableSch
|
||||
* Return statement
|
||||
*/
|
||||
return updatedEntry;
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = updateDb;
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
* Imports
|
||||
* ===================================
|
||||
*/
|
||||
const add = require("./db/add");
|
||||
const addDb = require("./db/addDb");
|
||||
const query = require("./db/query");
|
||||
const update = require("./db/updateDb");
|
||||
const deleteDb = require("./db/deleteDb");
|
||||
@@ -16,7 +16,7 @@ const deleteDb = require("./db/deleteDb");
|
||||
* ===================================
|
||||
*/
|
||||
const db = {
|
||||
add: add,
|
||||
add: addDb,
|
||||
update: update,
|
||||
delete: deleteDb,
|
||||
query: query,
|
||||
|
||||
Reference in New Issue
Block a user