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

Adding sqlite3_serialize and sqlite3_deserialize #530

Closed
Trinitek opened this issue Dec 25, 2022 · 4 comments · Fixed by #547
Closed

Adding sqlite3_serialize and sqlite3_deserialize #530

Trinitek opened this issue Dec 25, 2022 · 4 comments · Fixed by #547

Comments

@Trinitek
Copy link
Contributor

I have some code that brings in sqlite3_serialize() and sqlite3_deserialize() and uses raw.GetNativeLibraryName() to do so dynamically, and I think it would be good to bring these into SQLitePCL officially. I have one question before I open a PR however: sqlite3_serialize() has the potential to return a pointer that must be freed using sqlite3_free(). I noticed that the providers implement sqlite3_free() but it is not exposed in raw. Do you have any objections to exposing this?

@ericsink
Copy link
Owner

No problem with bringing sqlite3_free further up.

If you do end up submitting a PR, I'll give it a look.

@tipa
Copy link

tipa commented Jun 30, 2023

I would love to use the sqlite3_serialize() method.
My use-case is as follows: My app works on a local SQLite database, which contents can by synced through the Cloud. However, that database is potentially very large and has to be split up before uploading (in my case, I completely strip the table that contains large file BLOBs). The most efficient way I have found to do that is creating a second database file, attaching it to the main database and then transfer all tables over (except the one with the file BLOBs). After that, the file is read into memory and uploaded to the Cloud.
I think performance could be further improved if that second, small database is never stored on disk in the first place, but created as in-memory database. Currently, it is not possible for me to retrieve those bytes from an in-memory database - I hope that the sqlite3_serialize() method would be able to do that.

@ericsink
Copy link
Owner

Interesting use case.

There is a PR for this at #536 but it hasn't had any activity in a while.

@Trinitek
Copy link
Contributor Author

I finally have some time I can work on this. I'll open a PR either today or tomorrow if #536 isn't moving.

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 a pull request may close this issue.

3 participants