Updates
This commit is contained in:
@@ -4,14 +4,14 @@ import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
* # DSQL user read-only DB handler
|
||||
* @requires DSQL_DB_CONN - Gobal Variable for Datasquirel Database
|
||||
*/
|
||||
export default async function DB_HANDLER(...args: any[]) {
|
||||
export default async function DB_HANDLER(query: string, values?: any[]) {
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
|
||||
try {
|
||||
if (!CONNECTION)
|
||||
throw new Error("No Connection provided to DB_HANDLER function!");
|
||||
|
||||
const results = await CONNECTION.query(...args);
|
||||
const results = await CONNECTION.query(query, values);
|
||||
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -3,11 +3,11 @@ import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
export default async function LOCAL_DB_HANDLER(...args: any[]) {
|
||||
export default async function LOCAL_DB_HANDLER(query: string, values?: any[]) {
|
||||
const MASTER = grabDSQLConnection();
|
||||
|
||||
try {
|
||||
const results = await MASTER.query(...args);
|
||||
const results = await MASTER.query(query, values);
|
||||
|
||||
return JSON.parse(JSON.stringify(results));
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import mysql from "serverless-mysql";
|
||||
import grabDbSSL from "../grabDbSSL";
|
||||
import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
|
||||
/**
|
||||
* # DSQL user read-only DB handler
|
||||
*/
|
||||
export default function NO_DB_HANDLER(...args: any[]) {
|
||||
export default function NO_DB_HANDLER(query: string, values?: any[]) {
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
CONNECTION.query(...args)
|
||||
CONNECTION.query(query, values)
|
||||
.then((results) => {
|
||||
CONNECTION.end();
|
||||
resolve(JSON.parse(JSON.stringify(results)));
|
||||
|
||||
@@ -3,12 +3,12 @@ import grabDSQLConnection from "../../grab-dsql-connection";
|
||||
/**
|
||||
* # Root DB handler
|
||||
*/
|
||||
export default function ROOT_DB_HANDLER(...args: any[]) {
|
||||
export default function ROOT_DB_HANDLER(query: string, values?: any[]) {
|
||||
const CONNECTION = grabDSQLConnection();
|
||||
|
||||
try {
|
||||
return new Promise((resolve, reject) => {
|
||||
CONNECTION.query(...args)
|
||||
CONNECTION.query(query, values)
|
||||
.then((results) => {
|
||||
CONNECTION.end();
|
||||
resolve(JSON.parse(JSON.stringify(results)));
|
||||
|
||||
Reference in New Issue
Block a user