Skip to content

feat: add export, size, setUpdateHook to DB API#160

Open
DjDeveloperr wants to merge 6 commits intomainfrom
work
Open

feat: add export, size, setUpdateHook to DB API#160
DjDeveloperr wants to merge 6 commits intomainfrom
work

Conversation

@DjDeveloperr
Copy link
Member

several fixes as well:

  • string params with null characters
  • allow calling bind() before iteration over stmt

closes #158
closes #152
closes #148
closes #143

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing “sql.js-like” convenience APIs and fixes several long-standing SQLite interop issues in the Deno SQLite3 driver (serialization/export, size introspection, update hooks, correct handling of NUL bytes in TEXT, and bound-statement iteration behavior).

Changes:

  • Add Database.export() / Database.size() backed by sqlite3_serialize (+ docs/tests).
  • Add Database.setUpdateHook() (sqlite3_update_hook) with tests and documentation.
  • Fix TEXT retrieval to preserve embedded NUL bytes and allow bind() before iterating a statement.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/test.ts Adds coverage for export/size, bound iteration, update hooks, and NUL-containing strings.
src/symbols.ts Extracts/centralizes the Deno FFI symbol table (adds sqlite3_serialize / sqlite3_update_hook).
src/ffi.ts Uses the extracted symbols definition for dynamic library loading.
src/statement.ts Fixes TEXT decoding (NUL-safe) and avoids rebinding when params are already bound.
src/database.ts Implements setUpdateHook(), export(), and size().
src/constants.ts Adds SQLITE_SERIALIZE_NOCOPY constant for size introspection.
doc.md Documents export/size, iteration guidance, and update hooks.
README.md Updates the project tagline and copyright year.
LICENSE Updates copyright year.
Comments suppressed due to low confidence (1)

doc.md:445

  • Typo: “posiition” should be “position”.
Parameters can be bound both by name and positiion. To bind by name, just pass
an object mapping the parameter name to the value. To bind by position, pass the

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DjDeveloperr and others added 2 commits March 11, 2026 05:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants