This commit is contained in:
Benjamin Toby
2025-08-05 13:56:51 +01:00
parent ab13c68c8e
commit 43a741f9ac
26 changed files with 109 additions and 115 deletions
+2 -4
View File
@@ -1,4 +1,4 @@
import { DSQL_TableSchemaType } from "../../types";
import { DSQL_TableSchemaType, PostInsertReturn } from "../../types";
import { ConnectionConfig } from "mariadb";
type Param<T extends {
[k: string]: any;
@@ -18,7 +18,5 @@ type Param<T extends {
*/
export default function dbHandler<T extends {
[k: string]: any;
} = {
[k: string]: any;
}>({ query, values, noErrorLogs, database, config, }: Param<T>): Promise<T[] | T | null>;
} = PostInsertReturn>({ query, values, noErrorLogs, database, config, }: Param<T>): Promise<T[] | T | null>;
export {};
+5 -5
View File
@@ -27,16 +27,16 @@ function dbHandler(_a) {
try {
CONNECTION = yield (0, grab_dsql_connection_1.default)({ database, config });
if (query && values) {
const queryResults = yield CONNECTION.query(query, values);
results = queryResults[0];
const queryResults = (yield CONNECTION.query(query, values));
results = queryResults;
}
else {
const queryResults = yield CONNECTION.query(query);
results = queryResults[0];
const queryResults = (yield CONNECTION.query(query));
results = queryResults;
}
}
catch (error) {
console.log("Connection Info =>", CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.info);
console.log("Connection Info =>", CONNECTION === null || CONNECTION === void 0 ? void 0 : CONNECTION.getConfig());
if (error.message &&
typeof error.message == "string" &&
error.message.match(/Access denied for user.*password/i)) {
@@ -15,9 +15,5 @@ type CreateNewUserParams = {
host?: string;
password?: string;
};
export declare function createNewSQLUser({ host, password, username, }: CreateNewUserParams): Promise<{
[k: string]: any;
} | {
[k: string]: any;
}[] | null>;
export declare function createNewSQLUser({ host, password, username, }: CreateNewUserParams): Promise<import("../../../types").PostInsertReturn | import("../../../types").PostInsertReturn[] | null>;
export {};