⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpledynamicwrite.htm

📁 The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
💻 HTM
字号:
<pre><code><span class="codeComment">// Using a DynamicDBView to insert records into the database.

// Insert two rows into a table with unknown fields</span>
void SimpleDynamicWrite() {
	TIMESTAMP_STRUCT paramDate = {2012, 12, 23, 0, 0, 0, 0}; 
	<span class="codeComment">// Mayan DOOMSDAY! End of the Mayan 5126 year long calendar cycle starting from May 1, 3094 B.C.
	// Date is 13.13.13.0.0.0.0  4 Ahaw, 3 K'ank'in</span>
	
	DynamicDBView&lt;&gt; view(&quot;DB_EXAMPLE&quot;, &quot;*&quot;);

	DynamicDBView&lt;&gt;::insert_iterator write_it = view;

	<span class="codeComment">// NOTE: We need to construct r from the view itself since we
	// don't know what fields the table will contain.
	// We therefore make a call to the DataObj() function to have the
	// table return us a template row with the correct number of fields
	// and field types.</span>
	variant_row r(view.DataObj());

	<span class="codeComment">// Prepare the number of the beast!
	// Set all fields to the value 6,
	// except for the last column which is a date and cannot
	// currently accept numeric values</span>
	for (size_t i = 0; i &lt; r.size()-1; i++)
	{
		 r[i] = 6;
	}
	r[i] = paramDate;  <span class="codeComment">// set the Doomsdate</span>

	<span class="codeComment">// insert the number</span>
	*write_it = r;
	write_it++;

	<span class="codeComment">// Prepare the number of angels who stand before
	// the throne of God!
	// Set all fields to the value 7,
	// except for the last column which is a date and cannot
	// currently accept numeric values</span>
	for (i = 0; i &lt; r.size()-1; i++)
	{
		 r[i] = 7;
	}
	r[i] = paramDate;

	<span class="codeComment">// insert the number</span>
	*write_it = r;
	write_it++;
}
</code></pre>

⌨️ 快捷键说明

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