firebird-wasm 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/.tsbuildinfo.build +1 -1
  3. package/dist/batch-block.d.ts +60 -0
  4. package/dist/batch-block.d.ts.map +1 -0
  5. package/dist/batch-block.js +176 -0
  6. package/dist/batch-block.js.map +1 -0
  7. package/dist/browser/engine-transport.d.ts +8 -0
  8. package/dist/browser/engine-transport.d.ts.map +1 -1
  9. package/dist/browser/engine-transport.js +6 -0
  10. package/dist/browser/engine-transport.js.map +1 -1
  11. package/dist/browser/firebird-browser.d.ts +18 -0
  12. package/dist/browser/firebird-browser.d.ts.map +1 -1
  13. package/dist/browser/firebird-browser.js +9 -0
  14. package/dist/browser/firebird-browser.js.map +1 -1
  15. package/dist/browser/shared-transport.d.ts +1 -0
  16. package/dist/browser/shared-transport.d.ts.map +1 -1
  17. package/dist/browser/shared-transport.js +3 -0
  18. package/dist/browser/shared-transport.js.map +1 -1
  19. package/dist/browser/worker-protocol.d.ts +1 -1
  20. package/dist/browser/worker-protocol.d.ts.map +1 -1
  21. package/dist/browser/worker-transport.d.ts +1 -0
  22. package/dist/browser/worker-transport.d.ts.map +1 -1
  23. package/dist/browser/worker-transport.js +3 -0
  24. package/dist/browser/worker-transport.js.map +1 -1
  25. package/dist/firebird.d.ts +84 -2
  26. package/dist/firebird.d.ts.map +1 -1
  27. package/dist/firebird.js +403 -47
  28. package/dist/firebird.js.map +1 -1
  29. package/dist/types.d.ts +24 -0
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/wasm/firebird-embedded.js +1 -1
  32. package/dist/wasm/firebird-embedded.wasm +0 -0
  33. package/dist/wasm-loader.d.ts +7 -0
  34. package/dist/wasm-loader.d.ts.map +1 -1
  35. package/dist/wasm-loader.js.map +1 -1
  36. package/package.json +2 -1
package/dist/firebird.js CHANGED
@@ -4,6 +4,9 @@ exports.FirebirdTransaction = exports.FirebirdLite = void 0;
4
4
  const node_firebird_driver_1 = require("node-firebird-driver");
5
5
  const statement_types_1 = require("./statement-types");
6
6
  const sql_tag_1 = require("./sql-tag");
7
+ const batch_block_1 = require("./batch-block");
8
+ /** `isc_info_sql_stmt_select`: the statement type the shared read transaction runs. */
9
+ const STMT_SELECT = 1;
7
10
  let nativeDriver;
8
11
  /**
9
12
  * The native driver, loaded on first use rather than at import.
@@ -49,6 +52,12 @@ class FirebirdLite {
49
52
  this.client = null;
50
53
  this.attachment = null;
51
54
  this.closed = false;
55
+ /** The read-only transaction `query()` shares when `sharedReads` is on. */
56
+ this.readTransaction = null;
57
+ /** SQL texts that are not a SELECT, or that wrote: they get a transaction of their own. */
58
+ this.ownTransaction = new Set();
59
+ /** Statements kept prepared by their SQL text, once connected (`statementCache`). */
60
+ this.statements = null;
52
61
  this.dbPath = dbPath;
53
62
  this.libraryPath = options.libraryPath;
54
63
  this.connectOptions = {
@@ -56,6 +65,12 @@ class FirebirdLite {
56
65
  password: options.password,
57
66
  charSetForNONE: options.charset,
58
67
  };
68
+ this.sharedReads = options.sharedReads ?? false;
69
+ const size = options.statementCache ?? 0;
70
+ if (!Number.isInteger(size) || size < 0) {
71
+ throw new RangeError('statementCache is a whole number of statements, 0 or more');
72
+ }
73
+ this.statementCacheSize = size;
59
74
  }
60
75
  /**
61
76
  * Lazily initialize the native client and open (or create) the database.
@@ -75,6 +90,7 @@ class FirebirdLite {
75
90
  // Database does not exist yet – create it.
76
91
  this.attachment = await this.client.createDatabase(this.dbPath, this.connectOptions);
77
92
  }
93
+ this.statements = new StatementCache(this.attachment, this.statementCacheSize);
78
94
  }
79
95
  /**
80
96
  * Execute a DDL or DML statement that does not return rows.
@@ -105,42 +121,35 @@ class FirebirdLite {
105
121
  const { statement, options } = (0, sql_tag_1.resolveQueryCall)(sql, paramsOrOptions, maybeOptions);
106
122
  const rowMode = options.rowMode ?? 'object';
107
123
  const attachment = this.attachment;
124
+ if (this.sharedReads &&
125
+ options.isolationLevel === undefined &&
126
+ options.readOnly === undefined &&
127
+ !this.ownTransaction.has(statement.sql)) {
128
+ const shared = await this.sharedRead(statement.sql, statement.params, rowMode);
129
+ if (shared)
130
+ return shared;
131
+ }
132
+ await this.endReadTransaction();
108
133
  const txOptions = buildTransactionOptions(options);
109
134
  const transaction = await attachment.startTransaction(txOptions);
110
135
  try {
111
- const stmt = await attachment.prepare(transaction, statement.sql);
136
+ const lease = await this.statements.acquire(transaction, statement.sql);
137
+ const stmt = lease.stmt;
112
138
  let rows;
113
139
  let fields;
114
- // Disposed in `finally`, not after the fetch: a statement that throws on
140
+ // Released in `finally`, not after the fetch: a statement that throws on
115
141
  // execute — a lock conflict, an overflow, a wrong parameter count — would
116
142
  // otherwise leak its handle, and the retry loop such failures are usually
117
143
  // wrapped in leaks one per attempt until the attachment refuses more.
144
+ let failed = true;
118
145
  try {
119
146
  const columnLabels = await stmt.columnLabels;
120
147
  fields = columnLabels.map((label) => ({ name: label.toUpperCase() }));
121
- if (stmt.hasResultSet) {
122
- const resultSet = await stmt.executeQuery(transaction, statement.params);
123
- // Same reasoning one level down: a failing fetch must still close.
124
- try {
125
- const rawRows = await resultSet.fetch();
126
- // The driver already hands back positional rows, so array mode is
127
- // the shape that costs nothing — object mode is the one that
128
- // builds.
129
- rows = (rowMode === 'array'
130
- ? rawRows
131
- : rawRows.map((cols) => Object.fromEntries(fields.map((f, i) => [f.name, cols[i]]))));
132
- }
133
- finally {
134
- await resultSet.close().catch(() => undefined);
135
- }
136
- }
137
- else {
138
- await stmt.execute(transaction, statement.params);
139
- rows = [];
140
- }
148
+ rows = shapeRows(await fetchRows(stmt, transaction, statement.params, fields.length), fields, rowMode);
149
+ failed = false;
141
150
  }
142
151
  finally {
143
- await stmt.dispose().catch(() => undefined);
152
+ await lease.release(failed);
144
153
  }
145
154
  // After the statement is disposed, as before — the commit is the last
146
155
  // thing that happens on the success path.
@@ -152,6 +161,79 @@ class FirebirdLite {
152
161
  throw err;
153
162
  }
154
163
  }
164
+ /**
165
+ * Run a SELECT in the shared read-only transaction, starting it if need be.
166
+ *
167
+ * `undefined` means "run it in a transaction of its own": the statement is
168
+ * not a SELECT, or it tried to write ("attempted update during read-only
169
+ * transaction"). Either way its text is remembered, so the next call goes
170
+ * there directly. Any other failure ends the shared transaction, so the
171
+ * next read starts afresh, and is thrown.
172
+ */
173
+ async sharedRead(sql, params, rowMode) {
174
+ const attachment = this.attachment;
175
+ this.readTransaction ?? (this.readTransaction = await attachment.startTransaction({
176
+ isolation: node_firebird_driver_1.TransactionIsolation.READ_COMMITTED,
177
+ readCommittedMode: 'RECORD_VERSION',
178
+ accessMode: 'READ_ONLY',
179
+ }));
180
+ const transaction = this.readTransaction;
181
+ let lease;
182
+ try {
183
+ lease = await this.statements.acquire(transaction, sql);
184
+ }
185
+ catch (err) {
186
+ await this.endReadTransaction();
187
+ throw err;
188
+ }
189
+ const stmt = lease.stmt;
190
+ // A writing SELECT stays kept: only the transaction was wrong for it.
191
+ let failed = false;
192
+ try {
193
+ if ((await stmt.type) !== STMT_SELECT) {
194
+ this.remember(sql);
195
+ return undefined;
196
+ }
197
+ const fields = (await stmt.columnLabels).map((label) => ({
198
+ name: label.toUpperCase(),
199
+ }));
200
+ const rawRows = await fetchRows(stmt, transaction, params, fields.length);
201
+ return { rows: shapeRows(rawRows, fields, rowMode), fields };
202
+ }
203
+ catch (err) {
204
+ // The native driver's errors carry only the message text.
205
+ if (/attempted update during read-only transaction/.test(String(err?.message))) {
206
+ this.remember(sql);
207
+ return undefined;
208
+ }
209
+ failed = true;
210
+ await this.endReadTransaction();
211
+ throw err;
212
+ }
213
+ finally {
214
+ await lease.release(failed);
215
+ }
216
+ }
217
+ remember(sql) {
218
+ if (this.ownTransaction.size >= 1024)
219
+ this.ownTransaction.clear();
220
+ this.ownTransaction.add(sql);
221
+ }
222
+ /**
223
+ * End the shared read transaction, before anything but a shared read runs.
224
+ *
225
+ * On a server, an open transaction that has read a table makes `DROP TABLE`
226
+ * fail with "object in use", and `exec()` runs DDL without preparing it, so
227
+ * this cannot be kept to DDL as the WASM engine does: the shared transaction
228
+ * lives across consecutive reads only. A run of reads keeps it; a write
229
+ * between two reads costs what a transaction per read used to.
230
+ */
231
+ async endReadTransaction() {
232
+ const transaction = this.readTransaction;
233
+ this.readTransaction = null;
234
+ if (transaction)
235
+ await transaction.commit().catch(() => transaction.rollback().catch(() => undefined));
236
+ }
155
237
  /**
156
238
  * Describe a statement's shape without running it.
157
239
  *
@@ -208,8 +290,11 @@ class FirebirdLite {
208
290
  await this.ensureReady();
209
291
  const attachment = this.attachment;
210
292
  const txOptions = buildTransactionOptions(options);
293
+ await this.endReadTransaction();
211
294
  const transaction = await attachment.startTransaction(txOptions);
212
- const tx = new FirebirdTransaction(attachment, transaction);
295
+ // A shared read made from inside the callback starts the shared
296
+ // transaction again; each statement here ends it first.
297
+ const tx = new FirebirdTransaction(attachment, transaction, () => this.endReadTransaction(), this.statements ?? undefined);
213
298
  let result;
214
299
  try {
215
300
  result = await fn(tx);
@@ -236,6 +321,9 @@ class FirebirdLite {
236
321
  if (this.closed)
237
322
  return;
238
323
  this.closed = true;
324
+ await this.endReadTransaction();
325
+ await this.statements?.flush();
326
+ this.statements = null;
239
327
  if (this.attachment) {
240
328
  await this.attachment.disconnect().catch(() => undefined);
241
329
  this.attachment = null;
@@ -252,9 +340,11 @@ exports.FirebirdLite = FirebirdLite;
252
340
  * `FirebirdLite.transaction()`.
253
341
  */
254
342
  class FirebirdTransaction {
255
- constructor(attachment, transaction) {
343
+ constructor(attachment, transaction, beforeStatement = async () => undefined, statements = new StatementCache(attachment, 0)) {
256
344
  this.attachment = attachment;
257
345
  this.transaction = transaction;
346
+ this.beforeStatement = beforeStatement;
347
+ this.statements = statements;
258
348
  this.finished = false;
259
349
  }
260
350
  /** Whether this transaction has already been rolled back. */
@@ -284,14 +374,20 @@ class FirebirdTransaction {
284
374
  */
285
375
  async exec(sql, params = []) {
286
376
  this.assertUsable();
377
+ await this.beforeStatement();
287
378
  const statement = (0, sql_tag_1.toStatement)(sql, params);
288
- if (statement.params.length > 0) {
289
- const stmt = await this.attachment.prepare(this.transaction, statement.sql);
379
+ // With the cache off, a statement without parameters runs as it always
380
+ // did. With it on, every statement goes through the cache, which is also
381
+ // what sees DDL coming and empties itself first.
382
+ if (statement.params.length > 0 || this.statements.enabled) {
383
+ const lease = await this.statements.acquire(this.transaction, statement.sql);
384
+ let failed = true;
290
385
  try {
291
- await stmt.execute(this.transaction, statement.params);
386
+ await lease.stmt.execute(this.transaction, statement.params);
387
+ failed = false;
292
388
  }
293
389
  finally {
294
- await stmt.dispose().catch(() => undefined);
390
+ await lease.release(failed);
295
391
  }
296
392
  }
297
393
  else {
@@ -304,49 +400,124 @@ class FirebirdTransaction {
304
400
  */
305
401
  async execBatch(sql, rows) {
306
402
  this.assertUsable();
403
+ await this.beforeStatement();
307
404
  if (!Array.isArray(rows)) {
308
405
  throw new TypeError('execBatch takes an array of parameter rows');
309
406
  }
310
407
  if (rows.length === 0)
311
408
  return;
312
- const stmt = await this.attachment.prepare(this.transaction, sql);
409
+ const lease = await this.statements.acquire(this.transaction, sql);
410
+ let failed = true;
313
411
  try {
314
- for (const row of rows) {
315
- await stmt.execute(this.transaction, row);
412
+ const plan = rows.length > 1 ? await this.blockPlan(sql, lease.stmt) : undefined;
413
+ if (plan) {
414
+ await this.executeInBlocks(lease.stmt, plan, rows);
415
+ }
416
+ else {
417
+ for (const row of rows) {
418
+ await lease.stmt.execute(this.transaction, row);
419
+ }
420
+ }
421
+ failed = false;
422
+ }
423
+ finally {
424
+ await lease.release(failed);
425
+ }
426
+ }
427
+ /**
428
+ * How to run `sql` as an `EXECUTE BLOCK` over many rows, or `undefined` to
429
+ * run it row by row: it is not plain DML or a procedure call, it returns
430
+ * something, or a parameter's type cannot be declared. See batch-block.ts.
431
+ */
432
+ async blockPlan(sql, stmt) {
433
+ const type = await stmt.type;
434
+ // INSERT, UPDATE, DELETE, EXECUTE PROCEDURE; nothing with a result.
435
+ if (![2, 3, 4, 8].includes(type) || stmt.hasResultSet)
436
+ return undefined;
437
+ if ((await stmt.columnLabels).length > 0)
438
+ return undefined;
439
+ const params = await inputParams(stmt);
440
+ const offsets = (0, batch_block_1.placeholderOffsets)(sql);
441
+ if (!params || params.length === 0 || !offsets || offsets.length !== params.length) {
442
+ return undefined;
443
+ }
444
+ const charsets = await characterSets(this.attachment, this.transaction);
445
+ const types = params.map((p) => (0, batch_block_1.blockParamType)(p, charsets));
446
+ if (types.some((t) => t === undefined))
447
+ return undefined;
448
+ return { build: (rows) => (0, batch_block_1.buildBlock)(sql, offsets, types, rows) };
449
+ }
450
+ /**
451
+ * Run `rows` through blocks of up to {@link BLOCK_ROWS} rows each.
452
+ *
453
+ * A block that will not prepare (more contexts than the engine's 256,
454
+ * a message or BLR too long) is halved until it does; at one row the
455
+ * statement itself runs. A block that fails while running was undone as
456
+ * one statement, so its rows run again one by one: the failing row then
457
+ * throws exactly the error the row-by-row loop would have thrown.
458
+ */
459
+ async executeInBlocks(single, plan, rows) {
460
+ let size = Math.min(BLOCK_ROWS, rows.length);
461
+ let current;
462
+ try {
463
+ for (let at = 0; at < rows.length;) {
464
+ const chunk = rows.slice(at, at + size);
465
+ if (chunk.length === 1) {
466
+ await single.execute(this.transaction, chunk[0]);
467
+ at += 1;
468
+ continue;
469
+ }
470
+ if (current?.rows !== chunk.length) {
471
+ await current?.lease.release(false);
472
+ current = undefined;
473
+ try {
474
+ current = {
475
+ rows: chunk.length,
476
+ lease: await this.statements.acquire(this.transaction, plan.build(chunk.length)),
477
+ };
478
+ }
479
+ catch {
480
+ size = Math.max(1, chunk.length >> 1);
481
+ continue;
482
+ }
483
+ }
484
+ try {
485
+ await current.lease.stmt.execute(this.transaction, chunk.flat());
486
+ }
487
+ catch {
488
+ for (const row of chunk) {
489
+ await single.execute(this.transaction, row);
490
+ }
491
+ }
492
+ at += chunk.length;
316
493
  }
317
494
  }
318
495
  finally {
319
- await stmt.dispose().catch(() => undefined);
496
+ await current?.lease.release(false);
320
497
  }
321
498
  }
322
499
  async query(sql, params = [], options = {}) {
323
500
  this.assertUsable();
501
+ await this.beforeStatement();
324
502
  const statement = (0, sql_tag_1.toStatement)(sql, params);
325
503
  const rowMode = options.rowMode ?? 'object';
326
- const stmt = await this.attachment.prepare(this.transaction, statement.sql);
504
+ const lease = await this.statements.acquire(this.transaction, statement.sql);
505
+ const stmt = lease.stmt;
327
506
  // Same leak as FirebirdLite.query had: a statement or result set that
328
507
  // throws must still be released. More so here, because a transaction
329
508
  // callback that catches its own errors goes on using the same attachment.
509
+ let failed = true;
330
510
  try {
331
511
  const columnLabels = await stmt.columnLabels;
332
512
  const fields = columnLabels.map((label) => ({
333
513
  name: label.toUpperCase(),
334
514
  }));
335
- const resultSet = await stmt.executeQuery(this.transaction, statement.params);
336
- let rawRows;
337
- try {
338
- rawRows = await resultSet.fetch();
339
- }
340
- finally {
341
- await resultSet.close().catch(() => undefined);
342
- }
343
- const rows = (rowMode === 'array'
344
- ? rawRows
345
- : rawRows.map((cols) => Object.fromEntries(fields.map((f, i) => [f.name, cols[i]]))));
346
- return { rows, fields };
515
+ const rawRows = await fetchRows(stmt, this.transaction, statement.params, fields.length);
516
+ failed = false;
517
+ return { rows: shapeRows(rawRows, fields, rowMode), fields };
347
518
  }
348
519
  finally {
349
- await stmt.dispose().catch(() => undefined);
520
+ await lease.release(failed);
350
521
  }
351
522
  }
352
523
  }
@@ -354,6 +525,191 @@ exports.FirebirdTransaction = FirebirdTransaction;
354
525
  // ---------------------------------------------------------------------------
355
526
  // Module-level helpers
356
527
  // ---------------------------------------------------------------------------
528
+ /** Rows per `EXECUTE BLOCK` in `execBatch`: a single-table statement uses
529
+ * one of the engine's 256 contexts per row, so 200 leaves room. */
530
+ const BLOCK_ROWS = 200;
531
+ /**
532
+ * The driver's description of a statement's `?` parameters: its input
533
+ * metadata, after the driver's own rewrites (integers bound as doubles,
534
+ * CHAR as VARCHAR). Not public API: read from the native statement's
535
+ * fields, and `undefined` whenever they are not there, so a driver that
536
+ * changes shape makes `execBatch` fall back to one execute per row.
537
+ */
538
+ async function inputParams(stmt) {
539
+ const internal = stmt;
540
+ const meta = internal.inMetadata;
541
+ const client = internal.attachment?.client;
542
+ if (!meta || typeof meta.getCountSync !== 'function' || typeof client?.statusAction !== 'function') {
543
+ return undefined;
544
+ }
545
+ try {
546
+ return await client.statusAction(async (status) => {
547
+ const params = [];
548
+ for (let i = 0, n = meta.getCountSync(status); i < n; i++) {
549
+ params.push({
550
+ type: meta.getTypeSync(status, i),
551
+ subType: meta.getSubTypeSync(status, i),
552
+ length: meta.getLengthSync(status, i),
553
+ scale: meta.getScaleSync(status, i),
554
+ charSet: meta.getCharSetSync(status, i),
555
+ });
556
+ }
557
+ return params;
558
+ });
559
+ }
560
+ catch {
561
+ return undefined;
562
+ }
563
+ }
564
+ /** Character sets by id, read once per connection. */
565
+ const charsetCache = new WeakMap();
566
+ async function characterSets(attachment, transaction) {
567
+ let charsets = charsetCache.get(attachment);
568
+ if (!charsets) {
569
+ const resultSet = await attachment.executeQuery(transaction, 'SELECT RDB$CHARACTER_SET_ID, TRIM(RDB$CHARACTER_SET_NAME), RDB$BYTES_PER_CHARACTER FROM RDB$CHARACTER_SETS');
570
+ try {
571
+ charsets = new Map();
572
+ for (const [id, name, bytes] of (await resultSet.fetch())) {
573
+ charsets.set(id, { name, bytesPerCharacter: bytes });
574
+ }
575
+ }
576
+ finally {
577
+ await resultSet.close().catch(() => undefined);
578
+ }
579
+ charsetCache.set(attachment, charsets);
580
+ }
581
+ return charsets;
582
+ }
583
+ /** Statement types (`isc_info_sql_stmt_*`) the cache keeps: plain DML, SELECT, procedures. */
584
+ const CACHEABLE_TYPES = new Set([1, 2, 3, 4, 8, 12]);
585
+ /** `isc_info_sql_stmt_ddl`. */
586
+ const STMT_DDL = 5;
587
+ /**
588
+ * Prepared statements kept per connection, keyed by their SQL text, the most
589
+ * recently used last: what the WASM bridge does in C (`fb_statement_cache`),
590
+ * for the Node backend, where every prepare is a round trip to the server.
591
+ *
592
+ * A Firebird statement belongs to the attachment, not to the transaction it
593
+ * was prepared in, so a kept one runs in whichever transaction comes next.
594
+ * Only SELECT, INSERT, UPDATE, DELETE and EXECUTE PROCEDURE / BLOCK are kept.
595
+ * DDL is never kept, and empties the cache before it runs: a kept statement
596
+ * makes this connection's `DROP TABLE` fail with "object in use", and keeps
597
+ * running a procedure's old body after it is altered. A statement whose
598
+ * execution fails is dropped. One busy with a call still running is not
599
+ * handed to a second, concurrent call, which prepares its own.
600
+ *
601
+ * Size 0, the default, keeps nothing: each statement is prepared and disposed
602
+ * as before, and its type is never asked for.
603
+ */
604
+ class StatementCache {
605
+ constructor(attachment, size) {
606
+ this.attachment = attachment;
607
+ this.size = size;
608
+ this.kept = new Map();
609
+ }
610
+ get enabled() {
611
+ return this.size > 0;
612
+ }
613
+ async acquire(transaction, sql) {
614
+ const hit = this.kept.get(sql);
615
+ if (hit && !hit.busy) {
616
+ // Most recently used last: a Map iterates in insertion order.
617
+ this.kept.delete(sql);
618
+ this.kept.set(sql, hit);
619
+ hit.busy = true;
620
+ return this.lease(hit);
621
+ }
622
+ const stmt = await this.attachment.prepare(transaction, sql);
623
+ if (!this.enabled) {
624
+ return { stmt, release: () => stmt.dispose().catch(() => undefined) };
625
+ }
626
+ const type = await stmt.type;
627
+ if (type === STMT_DDL)
628
+ await this.flush();
629
+ const entry = { stmt, busy: true, kept: false };
630
+ if (!hit && CACHEABLE_TYPES.has(type)) {
631
+ entry.kept = true;
632
+ this.kept.set(sql, entry);
633
+ await this.evictBeyondSize();
634
+ }
635
+ return this.lease(entry);
636
+ }
637
+ /** Dispose every kept statement; those still busy go when released. */
638
+ async flush() {
639
+ const entries = [...this.kept.values()];
640
+ this.kept.clear();
641
+ for (const entry of entries) {
642
+ entry.kept = false;
643
+ if (!entry.busy)
644
+ await entry.stmt.dispose().catch(() => undefined);
645
+ }
646
+ }
647
+ lease(entry) {
648
+ return {
649
+ stmt: entry.stmt,
650
+ release: async (failed) => {
651
+ entry.busy = false;
652
+ if (entry.kept && failed) {
653
+ entry.kept = false;
654
+ for (const [sql, e] of this.kept) {
655
+ if (e === entry) {
656
+ this.kept.delete(sql);
657
+ break;
658
+ }
659
+ }
660
+ }
661
+ if (!entry.kept)
662
+ await entry.stmt.dispose().catch(() => undefined);
663
+ },
664
+ };
665
+ }
666
+ async evictBeyondSize() {
667
+ for (const [sql, entry] of this.kept) {
668
+ if (this.kept.size <= this.size)
669
+ return;
670
+ if (entry.busy)
671
+ continue;
672
+ this.kept.delete(sql);
673
+ entry.kept = false;
674
+ await entry.stmt.dispose().catch(() => undefined);
675
+ }
676
+ }
677
+ }
678
+ /**
679
+ * Run a prepared statement and return its rows, positionally.
680
+ *
681
+ * A SELECT has a cursor and is fetched. `EXECUTE PROCEDURE` has output
682
+ * columns but no cursor: it runs once, and its outputs are one row — run as
683
+ * a plain execute, they were dropped (`query()` returned no rows), and
684
+ * `executeQuery` refused it outright inside a transaction. Anything else
685
+ * runs and returns nothing.
686
+ */
687
+ async function fetchRows(stmt, transaction, params, columnCount) {
688
+ if (stmt.hasResultSet) {
689
+ const resultSet = await stmt.executeQuery(transaction, params);
690
+ // A failing fetch must still close.
691
+ try {
692
+ return await resultSet.fetch();
693
+ }
694
+ finally {
695
+ await resultSet.close().catch(() => undefined);
696
+ }
697
+ }
698
+ if (columnCount > 0) {
699
+ return [await stmt.executeSingleton(transaction, params)];
700
+ }
701
+ await stmt.execute(transaction, params);
702
+ return [];
703
+ }
704
+ /**
705
+ * The driver hands back positional rows, so array mode is the shape that
706
+ * costs nothing — object mode is the one that builds.
707
+ */
708
+ function shapeRows(rawRows, fields, rowMode) {
709
+ return (rowMode === 'array'
710
+ ? rawRows
711
+ : rawRows.map((cols) => Object.fromEntries(fields.map((f, i) => [f.name, cols[i]]))));
712
+ }
357
713
  function buildTransactionOptions(options) {
358
714
  const isolationMap = {
359
715
  READ_COMMITTED: node_firebird_driver_1.Transaction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CAAC,CAAC,CAAC,SAAS;KACvD,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -16,6 +16,30 @@ export interface FirebirdLiteOptions {
16
16
  username?: string;
17
17
  /** Firebird user password. */
18
18
  password?: string;
19
+ /**
20
+ * Run `query()` calls that are a `SELECT` in one read-only READ COMMITTED
21
+ * transaction kept open, instead of starting and committing a transaction
22
+ * around each. The browser backend's option of the same name; see
23
+ * `FirebirdBrowserOptions.sharedReads` for the two things that differ.
24
+ * A call that passes `isolationLevel` or `readOnly` keeps its own.
25
+ *
26
+ * @default false
27
+ */
28
+ sharedReads?: boolean;
29
+ /**
30
+ * How many prepared statements to keep by their SQL text, so a statement
31
+ * sent again skips the prepare (a round trip to the server). DDL run here
32
+ * empties the cache first. 0 keeps none.
33
+ *
34
+ * Off by default because what this connection keeps, other connections
35
+ * feel: a kept statement makes another connection's `DROP TABLE` of a table
36
+ * it reads wait until it is released, and keeps running a procedure's old
37
+ * body after another connection alters it. Turn it on where this process
38
+ * is the only one changing the schema while it runs.
39
+ *
40
+ * @default 0
41
+ */
42
+ statementCache?: number;
19
43
  }
20
44
  /**
21
45
  * Result returned from a query execution.