canonical / dqlite

Embeddable, replicated and fault-tolerant SQL engine.
https://dqlite.io
Other
3.83k stars 216 forks source link

C client: re-using SQLite interfaces that don't do I/O #463

Closed cole-miller closed 1 year ago

cole-miller commented 1 year ago

An important goal for the C client library is that porting an application from SQLite to dqlite should be convenient, involving as few invasive changes as possible. It's not possible to re-use functions like sqlite3_prepare_v2 or sqlite3_exec because the corresponding operation in dqlite needs to do novel things like connect to a leader and speak the wire protocol, but in principle it seems like we should be able to re-use many parts of the sqlite3 API that don't don't do any I/O. For example, it would be great if packing values into a tuple of statement parameters or unpacking a sequence of rows could work with no code changes when doing this migration.

The second-best interface would have dqlite* functions for all these purposes whose signatures are completely analogous to the sqlite3* function, so that most of migrating a codebase is just replacing the first part of the name of various functions.

A couple of issues:

cole-miller commented 1 year ago

Worth noting that even if we can't re-use many sqlite3 functions, we should be able to re-use the constants.

cole-miller commented 1 year ago

Closing this since it's not really tracking anything.