-
Notifications
You must be signed in to change notification settings - Fork 412
xConnect for virtual tables to query core db connection #1366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request has been marked as stale due to inactivity. It will be closed in 7 days if no further activity occurs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the virtual table API to pass a live database connection into extensions, adds a new TableStats
virtual table with tests for row counts, and revises the registration macros and core wiring to use weak references rather than bumping Rc
strong counts.
- Extend all
VTabModule::open
functions to accept an optionalConnection
handle. - Implement
connect
in the core so extensions get a weak-backedConn
pointer. - Add a new
tablestats
virtual table module and CLI tests for it.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
testing/cli_tests/extensions.py | Added new test_tablestats and adjusted TestLimboShell callsite. |
macros/src/lib.rs | Updated generated FFI signatures to pass conn and register it. |
extensions/tests/src/lib.rs | Added TableStats module implementation and derive boilerplate. |
extensions/series/src/lib.rs | Updated GenerateSeriesVTab::open signature and tests. |
extensions/core/src/vtabs.rs | Added conn field and new FFI types, updated VTabModule trait. |
extensions/core/src/types.rs | Introduced new ResultCode variants and StepResult . |
extensions/core/src/lib.rs | Exposed the new StepResult and core Connection API. |
extensions/core/README.md | Updated example to show passing Connection into open . |
extensions/completion/src/lib.rs | Updated CompletionVTab::open signature. |
core/types.rs | Added OwnedValue::from_ffi_ptr helper. |
core/ext/vtab_connect.rs | New FFI shims using weak Rc for extension connections. |
core/ext/mod.rs & core/ext/dynamic.rs | Wire the new connect function into dynamic and built-in loading. |
core/translate/main_loop.rs | Skip zero‐index constraints in best_index loop. |
core/lib.rs | Updated VirtualTable::open to forward conn pointer. |
Comments suppressed due to low confidence (2)
testing/cli_tests/extensions.py:502
- Other tests still call TestLimboShell() without arguments. If the constructor signature changed, those will break—unify all calls to use the new signature or overload the constructor.
limbo = TestLimboShell("")
extensions/core/README.md:195
- [nitpick] The example now mentions
Rc<Connection>
but does not show importingstd::rc::Rc
(orlimbo_ext::Connection
). Add those use statements to keep the snippet complete.
fn open(&self, conn: Option<Rc<Connection>>) -> Result<Self::VCursor, Self::Error> {
Re-Opening #1076 because it had bit-rotted to a point of no return.
However it has improved. Now with Weak references and no incrementing Rc strong counts.
This also includes a better test extension that returns info about the other tables in the schema.

(theme doesn't show rows column)