tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.55k stars 252 forks source link

[C Bindings] missing column type enum #1412

Closed ospfranco closed 4 months ago

ospfranco commented 4 months ago

When using the C experimental bindings I'm missing the enum for the mapping of the int to the column type. I'm guessing they match the sqlite3 types but since they are not in the headers I would have to go spelunking to map them.

Can you add the enum to the types? a #[repr(C)] (link) should be used in case they come from Rust code.

ospfranco commented 4 months ago

I just took a look into the sqlite docs, and they are pre-processor macros. Patched my code for now with:

#define LIBSQL_INT 1
#define LIBSQL_FLOAT 2
#define LIBSQL_TEXT 3
#define LIBSQL_BLOB 4
#define LIBSQL_NULL 5
haaawk commented 4 months ago

It does not seem that we could expose the enum directly as the order of values there is different than the numbers they map to. We could define LIBSQL_INT, LIBSQL_FLOAT, .... and so on.