feat: fix raw results to really show the raw DB results

This commit is contained in:
2025-09-16 21:08:22 -06:00
parent 2a932af806
commit 297fe3cec6
5 changed files with 66 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ import {
import { logger } from "../../utils/logger";
interface QueuedOperation {
type: "run" | "query";
type: "run" | "query" | "rawQuery";
sql: string;
params: unknown[];
resolve: (value: unknown) => void;
@@ -159,6 +159,14 @@ export class CapacitorPlatformService implements PlatformService {
};
break;
}
case "rawQuery": {
const queryResult = await this.db.query(
operation.sql,
operation.params,
);
result = queryResult;
break;
}
}
operation.resolve(result);
} catch (error) {
@@ -1270,6 +1278,14 @@ export class CapacitorPlatformService implements PlatformService {
return undefined;
}
/**
* @see PlatformService.dbRawQuery
*/
async dbRawQuery(sql: string, params?: unknown[]): Promise<unknown> {
await this.waitForInitialization();
return this.queueOperation("rawQuery", sql, params || []);
}
/**
* Checks if running on Capacitor platform.
* @returns true, as this is the Capacitor implementation