Skip to content
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

vtable support #15

Closed
jrossi opened this issue Jun 4, 2021 · 7 comments
Closed

vtable support #15

jrossi opened this issue Jun 4, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@jrossi
Copy link

jrossi commented Jun 4, 2021

Been playing around with this project and was wondering if you had plans to implement virtual table support?

@zombiezen zombiezen added the enhancement New feature or request label Jun 4, 2021
@zombiezen
Copy link
Owner

I didn't have any immediate plans, since I haven't really used the feature much myself. Looking at https://sqlite.org/vtab.html, the API surface area is pretty large, so I would want to approach it pretty deliberately to make sure the Go API is reasonable.

@anacrolix
Copy link
Contributor

I have been using go.riyazali.net/sqlite mentioned also here crawshaw/sqlite#98 (comment). I suspect I can load extensions produced by that library just fine with crawshaw.io/sqlite. Would I be correct in assuming that I can't load C shared extensions with zombiezen/go-sqlite because it's not actually calling in to or expecting actual C interfaces (due to modernc/sqlite)?

Would there be any way to make this work if that's correct? Could I somehow build extensions to be loadable by this module/modernc/sqlite? Thanks!

@zombiezen
Copy link
Owner

You are correct that you would not be able to load a shared object with this library: the C symbols would not be present, because modernc transpiles them to Go.

IIUC, the package you mention is a way of writing Go code that connects into the SQLite C API. If you can port the usages over to calling the modernc.org/sqlite/lib calls (which are 1:1 transpilations), then you should be able to reuse that work. I'm not sure how feasible that is.

@anacrolix
Copy link
Contributor

Thanks!

@anacrolix
Copy link
Contributor

It's a bit outside my experience to add this support through the lens of modern.org/sqlite. It's several layers of obscurity. I did eventually run into performance issues in a Go-to-C extension, callbacks from C to Go put a lot of stress on the Go scheduler. This wouldn't occur for a pure-Go implementation, but you would also be losing the ability to load the extension from C as a loadable extension.

@anacrolix
Copy link
Contributor

Thanks for your great work on this!

@zombiezen
Copy link
Owner

You're welcome! Feel free to pull down the latest main and try it out before I cut the release. I've written some example code to verify the functionality and get a rough feel for the API, but additional feedback (even if it's just "yup, looks right") would be very appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants