go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Can the resulting .sqlite3 file of a in-memory database be read somehow?

Open tonyborchert opened this issue 3 years ago • 3 comments

Imagine a simple http server that gets sent some sql. The server then executes the sql and sends back the resulting .sqlite3 file. My idea of doing something similar like that, would be to create a in memory database, execute the sql there (no problem so far), and then send back the resulting .sqlite3 file.

However i have found no way of doing this. I've even looked for some function in sqlite3, that might return the binary data associated with a .sqlite3 file, however i have found not anything, except this , which sadly does not help at all.

tonyborchert avatar Mar 30 '22 10:03 tonyborchert

Sounds like you want to use serialize.

https://www.sqlite.org/c3ref/serialize.html

otoolep avatar Mar 30 '22 11:03 otoolep

rqlite makes use of the call, from Go.

https://github.com/rqlite/rqlite/blob/db5946f296594aee52c84e2606046560b0f32ed5/db/db.go#L662

otoolep avatar Mar 30 '22 11:03 otoolep

@bit-burger Does this resolve your question?

rittneje avatar May 28 '22 04:05 rittneje