tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.

Home Page:https://turso.tech/libsql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[C Bindings] missing column type enum

ospfranco opened this issue · comments

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.

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

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.