bcafunctor.htm

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

HTM
24
字号
<pre><code><span class="codeComment">Functor to bind SQL columns to a data object</span>
class Example
{
  public:                                        <span class="codeComment">// tablename.columnname:</span>
	int exampleInt;                         <span class="codeComment">// DB_EXAMPLE.INT_VALUE</span>
	string exampleStr;                      <span class="codeComment">// DB_EXAMPLE.STRING_VALUE</span>
	double exampleDouble;                   <span class="codeComment">// DB_EXAMPLE.DOUBLE_VALUE</span>
	long exampleLong;                       <span class="codeComment">// DB_EXAMPLE.EXAMPLE_LONG</span>
	TIMESTAMP_STRUCT exampleDate;           <span class="codeComment">// DB_EXAMPLE.EXAMPLE_DATE</span>
};</pre>

<pre>class BCAExampleObj
{
public:
	void operator()(BoundIOs &amp;boundIOs, Example &amp;rowbuf)
    	{
	   boundIOs[&quot;INT_VALUE&quot;] 	== rowbuf.exampleInt;
	   boundIOs[&quot;STRING_VALUE&quot;]	== rowbuf.exampleStr;
	   boundIOs[&quot;DOUBLE_VALUE&quot;]	== rowbuf.exampleDouble;
	   boundIOs[&quot;EXAMPLE_LONG&quot;]	== rowbuf.exampleLong;
	   boundIOs[&quot;EXAMPLE_DATE&quot;]	== rowbuf.exampleDate;
	}
};
</code></pre>

⌨️ 快捷键说明

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