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

Support loading extensions (closes #136) #160

Merged
merged 7 commits into from
Sep 8, 2021

Conversation

mindreframer
Copy link
Contributor

As initial selection for SQLITE extensions we take https://github.com/nalgeon/sqlean with some additions in this fork (https://github.com/mindreframer/sqlean) + packaged as Hex package here: https://hex.pm/packages/ex_sqlean.

To keep the usage for Exqlite somewhat simpler and consistent, a new module is introduced: BasicAPI. It allows simple operations without the confusion between Exqlite.Sqlite3 and Exqlite.Connection modules to execute queries and dealing with results.

As initial selection for SQLITE extensions we take https://github.com/nalgeon/sqlean with some additions in this fork (https://github.com/mindreframer/sqlean) + packaged as Hex package here: https://hex.pm/packages/ex_sqlean. 


To keep the usage for Exqlite somewhat simpler and consistent, a new module is introduced: BasicAPI. It allows simple operations without the confusion between Exqlite.Sqlite3 and Exqlite.Connection modules to execute queries and dealing with results.
@mindreframer
Copy link
Contributor Author

@warmwaffles @kevinlang @cw789 Ping?

mix.exs Show resolved Hide resolved
@warmwaffles
Copy link
Member

@mindreframer I've never actually loaded extensions before. Do you have to unload them before you close the sqlite connection?

@mindreframer
Copy link
Contributor Author

@warmwaffles I don't think so. Just closing SQLite connection is enough. An extension is loaded in the context of a connection and does not linger around / or leak to other connections.

@mindreframer
Copy link
Contributor Author

@warmwaffles Feel free to play around and suggest some further improvements. I'm not a C programmer, so I kinda copy-pasted the NIF code together, and worked around the booleans by mapping them to 1/0 in the sqlite3.ex file. It might not be 100% bullet proof, but got the job done.

@warmwaffles
Copy link
Member

The C code looks completely fine.

@cw789
Copy link
Contributor

cw789 commented Sep 8, 2021

@cw789 Ping?

Thanks for asking. But I think I could not help much regarding this.
OTP 21+ is also fine in my opinion.

If you really ask me, I think I would miss how I could use SQLean or other Plugins (if others exists).
A little bit of docs? ;)

@mindreframer
Copy link
Contributor Author

@cw789 Thanks for the feedback! I have added a section in the Readme with some code snippets about how to use SQLean extensions.

@warmwaffles warmwaffles merged commit 69a6c27 into elixir-sqlite:main Sep 8, 2021
@mindreframer
Copy link
Contributor Author

@warmwaffles thanks for merging!

@cw789
Copy link
Contributor

cw789 commented Sep 8, 2021

Thanks for making.

@warmwaffles
Copy link
Member

No problem. I was eyeballing sqlean a while back but decided against incorporating it into this library. Having it as an external is totally fine.

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

Successfully merging this pull request may close these issues.

3 participants