[英]Difference between soci::i_ok and soci::i_null
I could not find an explanation of the soci::i_ok and soci::i_null constants. 我找不到soci :: i_ok和soci :: i_null常量的解释。 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是否为真,是否表示数据不为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. 根据文档, soci::i_ok
指示返回的值没有任何错误,并且包含一个非空值。 And soci::i_null
means that the value is null, because the column contained a null value. soci::i_null
表示该值为null,因为该列包含一个null值。
So, yeah, (soci::i_ok == indicatorX)
means, (soci::i_null != indicatorX)
and there are no fetch errors. 因此,是的, (soci::i_ok == indicatorX)
表示(soci::i_null != indicatorX)
并且没有提取错误。 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). 作为soci::i_ok
包括使用的soci::i_null
我猜两个常量放在不同的原因(例如,如果你想要一个明确的空检查)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.