Updates
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import dbHandler from "../db-handler";
|
||||
import _ from "lodash";
|
||||
import type {
|
||||
BunMariaDBConfig,
|
||||
DBResponseObject,
|
||||
SQLInsertGenValueType,
|
||||
ServerQueryParam,
|
||||
@@ -15,6 +16,7 @@ type Params<
|
||||
data: Schema;
|
||||
query?: ServerQueryParam<Schema>;
|
||||
targetId?: number | string;
|
||||
config?: BunMariaDBConfig;
|
||||
};
|
||||
|
||||
function quoteIdentifier(identifier: string): string {
|
||||
@@ -29,6 +31,7 @@ export default async function DbUpdate<
|
||||
data,
|
||||
query,
|
||||
targetId,
|
||||
config,
|
||||
}: Params<Schema, Table>): Promise<DBResponseObject> {
|
||||
let sqlObj: ReturnType<typeof sqlGenerator> = { string: "", values: [] };
|
||||
|
||||
@@ -93,6 +96,7 @@ export default async function DbUpdate<
|
||||
const res = await dbHandler({
|
||||
query: sql,
|
||||
values: values as any,
|
||||
config,
|
||||
});
|
||||
|
||||
sqlObj.string = sql;
|
||||
@@ -122,6 +126,7 @@ export default async function DbUpdate<
|
||||
const updated_res = await dbHandler({
|
||||
query: updated_sql,
|
||||
values: updated_sql_values,
|
||||
config,
|
||||
});
|
||||
|
||||
const affected_rows = updated_res.payload?.length;
|
||||
|
||||
Reference in New Issue
Block a user