-
Notifications
You must be signed in to change notification settings - Fork 203
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
Using sqlite extensions with sqlite3 gem #383
Comments
Hi! Thanks for asking this question. You can load sqlite3 extensions using the db = SQLite3::Database.new(':memory:')
db.enable_load_extension(true)
db.load_extension(path_to_shared_object) where Does this answer help? |
Hi, thanks for your response! I assume that the native sqlite binary that comes with the default gem or bundle install (I am on Ubuntu) doesn't have that (or any other) extension bundled - so I would need to compile it myself as documented here, I guess. |
@cboulanger Yep, I was able to do this on my linux machine (after cloning sqlite/sqlite) # in sqlite directory
gcc -g -fPIC -shared ./ext/misc/spellfix.c -o spellfix.o then, in ruby: #! /usr/bin/env ruby
require "sqlite3"
db = SQLite3::Database.new(':memory:')
db.enable_load_extension(true)
db.load_extension("/path/to/sqlite/spellfix.o")
db.execute("CREATE VIRTUAL TABLE demo USING spellfix1;") I'm going to close this, but please do comment if you have any other questions! |
It works! Thanks so much. I've created a small gist for future reference: https://gist.github.com/cboulanger/f9c57fe2258e3b95c2f59ae10096a1f3 |
Note: I've extracted some of what we talked about here into INSTALLATION.md in #390 |
Hi, I am interested in using the spellfix extension with the sqlite3 gem.
https://www.sqlite.org/spellfix1.html
https://github.com/sqlite/sqlite/blob/master/ext/misc/spellfix.c
is this possible? Of course, it would be great if no compilation step was needed (via the OS sqlite?).
Thank you.
The text was updated successfully, but these errors were encountered: