defaultselval.htm

来自「The goal of this library is to make ODBC」· HTM 代码 · 共 26 行

HTM
26
字号
<pre><code><span class="codeComment">//Default SelVal function to make sure fields in a row selected from the database are valid

// Default select validation behavior ... data is valid if and only if
// there are no columns which are null.
// If there are other checks you wish to make, put them in
// your own SelVal functor.
// You can also specialize this template if you wish to have different default behavior
// for your data class.</span>
template&lt;class DataObj&gt; class DefaultSelValidate {
public:
bool operator()(BoundIOs &amp;boundIOs,DataObj &amp;rowbuf)
{
	for (BoundIOs::iterator b_it = boundIOs.begin();
				b_it != boundIOs.end(); b_it++)
	{
		BoundIO &amp;boundIO = (*b_it).second;
		if (boundIO.IsColumn() &amp;&amp; boundIO.IsNull())
			return false;  <span class="codeComment">// found null column ... data is invalid</span>
	}

	return true;	<span class="codeComment">// no nulls found ... data is OK</span>
}
};

</code></pre>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?