I could not find an explanation of the soci::i_ok and soci::i_null constants. They are mentioned in this page as possible states of data, but their exact meaning is not defined.
I was wondering if soci::i_ok is true does it mean that the data is not null?
(soci::i_ok == indicatorX) == (soci::i_null != indicatorX) ---?
I found some explanation to the question on this page under the topic: Handling nulls and other conditions. Sharing it here, for the benefit of the community.
Based on the document, soci::i_ok
indicates that the value is returned without any error and it contains a not null value. And soci::i_null
means that the value is null, because the column contained a null value.
So, yeah, (soci::i_ok == indicatorX)
means, (soci::i_null != indicatorX)
and there are no fetch errors. As soci::i_ok
encompasses the use of soci::i_null
I guess the two constants were placed for different reasons (like if you want an explicit null check).