This commit is contained in:
Tben 2023-08-12 17:23:52 +01:00
parent 32785f9caa
commit f0feaf508b
3 changed files with 4 additions and 13 deletions

View File

@ -44,9 +44,9 @@ module.exports = async function varDatabaseDbHandler({ queryString, queryValuesA
* @description Fetch data from db if no cache * @description Fetch data from db if no cache
*/ */
try { try {
if (queryString && queryValuesArray && Array.isArray(queryValuesArray) && queryValuesArray[0]) { if (queryString && Array.isArray(queryValuesArray) && queryValuesArray[0]) {
results = await dbHandler({ query: queryString, values: queryValuesArray, database: database }); results = await dbHandler({ query: queryString, values: queryValuesArray, database: database });
} else { } else if (queryString && !Array.isArray(queryValuesArray)) {
results = await dbHandler({ query: queryString, database: database }); results = await dbHandler({ query: queryString, database: database });
} }

View File

@ -30,20 +30,11 @@ const runQuery = require("./utils/runQuery");
*/ */
async function localGet({ options, dbSchema }) { async function localGet({ options, dbSchema }) {
try { try {
const { query } = options; const { query, queryValues } = options;
/** @type {string | undefined | any } */ /** @type {string | undefined | any } */
const tableName = options?.tableName ? options.tableName : undefined; const tableName = options?.tableName ? options.tableName : undefined;
/** @type {string[] | undefined } */
let queryValues;
if (options?.queryValues && typeof options?.queryValues === "string") {
try {
queryValues = JSON.parse(options.queryValues);
} catch (error) {}
}
const dbFullName = process.env.DSQL_DB_NAME || ""; const dbFullName = process.env.DSQL_DB_NAME || "";
/** /**

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.6.0", "version": "1.6.1",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {