sqlx
sqlx copied to clipboard
SQLite: `Column#type_info` and `ValueRef#type_info` APIs differ
This is by design I guess, but the APIs for getting the type info from the column and the value in SQLite could be better.
An example, if querying a column with a declaration type of BOOLEAN, the column says the type is BOOLEAN, but the ValueRef gives INTEGER. On a dynamic context, detecting the right type for the return value requires one to check both types.
What we could have is a unified API, where we'd get exactly the right type information from both. Here obviously BOOLEAN is the right answer, and other examples would be INTEGER/DATE and INTEGER/DATETIME.
In certain cases, like selecting values that are not in columns, the column's type info is NULL, which is not really useful at all. In these cases one must check value's type info to get the right answer.
@ljluestc
Am I missing something?
Where does C++ come fit into this issue? sqlx is written in rust and SQLite3 is written in C..