UNPKG

web_plsql

Version:

The Express Middleware for Oracle PL/SQL

68 lines (66 loc) 1.49 kB
import { t as __exportAll } from "./chunk-DQk6qfdC.mjs"; //#region src/backend/util/oracledb-mock.ts var oracledb_mock_exports = /* @__PURE__ */ __exportAll({ createPool: () => createPool, setExecuteCallback: () => setExecuteCallback }); let executeCallback = null; /** * Test utility: Set the callback for execute calls. * @param cb - The callback */ const setExecuteCallback = (cb) => { executeCallback = cb; }; /** * Mock LOB class. */ var MockLob = class { type; constructor(type) { this.type = type; } destroy() {} }; /** * Mock Connection class. */ var MockConnection = class { async execute(sql, bindParams, _options) { if (executeCallback) return await executeCallback(sql, bindParams); return { rows: [] }; } async createLob(type) { return new MockLob(type); } async commit() {} async rollback() {} async release() {} }; /** * Mock Pool class. */ var MockPool = class { connectionsOpen = 0; connectionsInUse = 0; async getConnection() { this.connectionsInUse++; this.connectionsOpen = Math.max(this.connectionsOpen, this.connectionsInUse); return new MockConnection(); } async close(_drainTime) { this.connectionsOpen = 0; this.connectionsInUse = 0; } }; /** * Mock createPool function. * @param _config - The configuration * @returns The pool */ async function createPool(_config) { return new MockPool(); } //#endregion export { setExecuteCallback as n, oracledb_mock_exports as t }; //# sourceMappingURL=oracledb-mock-Dn8aHtd7.mjs.map