fix query

This commit is contained in:
Rizky 2024-04-20 14:04:08 +07:00
parent 32a67fdcfe
commit ef4c14cb8f
1 changed files with 4 additions and 0 deletions

View File

@ -196,6 +196,10 @@ export const execQuery = async (args: DBArg, prisma: any) => {
const u8 = new Uint8Array([...atob(gzip)].map((c) => c.charCodeAt(0)));
const json = JSON.parse((await gunzipAsync(u8)).toString("utf8"));
if (table === "$queryRawUnsafe") {
return await tableInstance.bind(prisma)(...json);
}
if (Array.isArray(json)) {
const q = json.shift();
return await tableInstance.bind(prisma)(Prisma.sql(q, ...json));