I want to detect column data types of any SELECT
query in SQLite.
In the C API, there is const char *sqlite3_column_decltype(sqlite3_stmt*,int)
for this purpose. But that only works for columns in a real table. Expressions, such as LOWER('ABC')
, or columns from queries like PRAGMA foreign_key_list("mytable")
, always return null
here.
I know there is also typeof(col)
, but I don't have control over the fired SQL, so I need a way to extract the data type out of the prepared statement.