Question

I'm using SQLite with C API. On C API, I can check the result value of a column with sqlite3_column_* functions. the problem is there is no function for the case of the value is NULL. Of course, I can check the value with sqlite3_column_bytes function, but it can cause conversion, and I want to avoid conversion at all.

How can I check the value at a column of a row is NULL or not?

Was it helpful?

Solution

From what I can remember (and tell from the documentation), the correct way to do it is to use sqlite3_column_type() to check for SQLITE_NULL.

Just be sure to do it before doing anything that may cause conversion of the column.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top