feat: add export, size, setUpdateHook to DB API#160
Open
DjDeveloperr wants to merge 6 commits intomainfrom
Open
feat: add export, size, setUpdateHook to DB API#160DjDeveloperr wants to merge 6 commits intomainfrom
DjDeveloperr wants to merge 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
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 bysqlite3_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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
several fixes as well:
closes #158
closes #152
closes #148
closes #143