Skip to content

336 update prepared statement - #337

Merged
dumblepy merged 4 commits into
mainfrom
336-update-prepared-statement
Apr 3, 2026
Merged

dumblepy merged 4 commits into
mainfrom
336-update-prepared-statement

Conversation

@dumblepy

@dumblepy dumblepy commented Apr 3, 2026

Copy link
Copy Markdown
Owner

Add prepared statement support across RDB drivers (incl. SurrealDB v3)

Summary

This PR introduces a unified prepared statement API across SQLite/PostgreSQL/MySQL/MariaDB, including per-pool caching and connection-scoped execution via withConn / *PreparedContext. It also adds SurrealDB v3 “prepared statement” support by emulating server-side prepare through client-side template reuse: ? placeholders are normalized into SurrealQL parameters and bound values are emitted as LET statements, executed in a single /sql request for safe reuse.

Additionally, it improves pool waiter behavior to ensure concurrent requests correctly complete under tight pool limits, and it updates docs, examples/benchmarks, and test coverage accordingly.

Key changes

  • Cross-driver prepared statement API: prepare, get, first, exec, close, plus cache controls flushStmt / clearStmtCache
  • withConn support via *PreparedContext, including validation of connection ownership/index
  • SurrealDB v3 prepared statements implemented via LET + /sql multi-statement template expansion
  • Pool waiter improvements (notify-based) with new/updated test_pool_wait coverage
  • Docs and benchmarks updated; new prepared statement tests added for all supported backends

Test plan

  • Run the project’s test suite (including the prepared statement and pool-wait tests for SQLite/PostgreSQL/MySQL/MariaDB/SurrealDB).

dumblepy added 4 commits April 3, 2026 08:38
- Add per-SQL prepared statement cache with logical close
- Introduce `withConn` and prepared context overloads; add `clearStmtCache`/`flushStmt`
- Extend prepared-statement tests and warm benchmarks; update Makefile compose start
- Add per-SQL prepared statement cache and `SqlitePreparedContext`
- Make `close()` a logical close; introduce `flushStmt` and `clearStmtCache`
- Add `withConn` and `ctx` overloads for prepared `first/get/exec` APIs
- Update warm benchmark path and expand SQLite prepared-statement tests
Add prepared statement types, statement cache lifecycle, context-aware execution, and update SurrealDB query builder docs with accompanying tests.
@dumblepy dumblepy linked an issue Apr 3, 2026 that may be closed by this pull request
@dumblepy
dumblepy merged commit daa8e86 into main Apr 3, 2026
5 checks passed
@dumblepy
dumblepy deleted the 336-update-prepared-statement branch April 3, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update prepared statement

1 participant