﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Daywei0123-随笔分类-DB</title><link>http://www.cppblog.com/Daywei0123/category/19582.html</link><description>技术追求卓越 梦想创造未来</description><language>zh-cn</language><lastBuildDate>Wed, 18 Mar 2015 23:51:48 GMT</lastBuildDate><pubDate>Wed, 18 Mar 2015 23:51:48 GMT</pubDate><ttl>60</ttl><item><title>SQL使用记录</title><link>http://www.cppblog.com/Daywei0123/archive/2015/03/17/210079.html</link><dc:creator>Daywei</dc:creator><author>Daywei</author><pubDate>Tue, 17 Mar 2015 07:43:00 GMT</pubDate><guid>http://www.cppblog.com/Daywei0123/archive/2015/03/17/210079.html</guid><wfw:comment>http://www.cppblog.com/Daywei0123/comments/210079.html</wfw:comment><comments>http://www.cppblog.com/Daywei0123/archive/2015/03/17/210079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Daywei0123/comments/commentRss/210079.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Daywei0123/services/trackbacks/210079.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 问题：Update字段来自子查询或者来自其他表字段Update 语句Update 语句用于修改表中的数据。语法：UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值SQL update select语句最常用的update语法是：UPDATE &lt;table_name&gt; SET &lt;column_name1&gt; = &lt;value&...&nbsp;&nbsp;<a href='http://www.cppblog.com/Daywei0123/archive/2015/03/17/210079.html'>阅读全文</a><img src ="http://www.cppblog.com/Daywei0123/aggbug/210079.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Daywei0123/" target="_blank">Daywei</a> 2015-03-17 15:43 <a href="http://www.cppblog.com/Daywei0123/archive/2015/03/17/210079.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C、C++写二进制数据到mysql的Blob字段 </title><link>http://www.cppblog.com/Daywei0123/archive/2012/07/05/181479.html</link><dc:creator>Daywei</dc:creator><author>Daywei</author><pubDate>Thu, 05 Jul 2012 08:06:00 GMT</pubDate><guid>http://www.cppblog.com/Daywei0123/archive/2012/07/05/181479.html</guid><wfw:comment>http://www.cppblog.com/Daywei0123/comments/181479.html</wfw:comment><comments>http://www.cppblog.com/Daywei0123/archive/2012/07/05/181479.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Daywei0123/comments/commentRss/181479.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Daywei0123/services/trackbacks/181479.html</trackback:ping><description><![CDATA[<p><span style="font-family: Times New Roman; font-size: 16px"><strong>-- 引子--<br /></strong></p>
<p><span style="font-family: 宋体">由于调试需要，需直接往数据库里写入二进制数据。本来这些数据是由上层软件来写的，用的是</span>C#<span style="font-family: 宋体">。为了熟悉</span>C<span style="font-family: 宋体">语言的数据库操作，还是决定用</span>C<span style="font-family: 宋体">来写这段调试代码。</span></p>
<p><span style="font-family: 宋体">概况：</span></p>
<p><span style="font-family: 宋体">表名：</span>Task</p>
<p><span style="font-family: 宋体">涉及的字段及属性：</span></p>
<p>NumDest<span style="font-family: 宋体">：</span>int(11) <span style="font-family: 宋体">用于存储目标数目</span></p>
<p>destIDs: blob <span style="font-family: 宋体">用于存储具体的目标</span>ID</p>
<p><span style="font-family: 宋体">废话不多说，入正题。</span></p>
<p><span style="font-family: 宋体"><span style="font-weight: bold"><br /></span></span></p>
<p><span style="font-family: 宋体"><span style="font-weight: bold"><br /></span></span></p>
<p><span style="font-family: 宋体"><span style="font-weight: bold">--二进制数据写入--</span><br /></span></p>
<p><span style="font-family: 宋体">二进制数据最为常见的就是图片等一些文件信息。虽然我这里不是这类型信息，但确实是二进制数据。</span></p>
<p><span style="font-family: 宋体">具体步骤：</span></p>
<p style="text-indent: -18pt; margin-left: 39pt"><span>1、 </span><span style="font-family: 宋体">定义一个</span>buffer<span style="font-family: 宋体">（如数组）来存储</span>sql<span style="font-family: 宋体">语句</span></p>
<p style="text-indent: -18pt; margin-left: 39pt"><span>2、 </span><span style="font-family: 宋体">把涉及到二进制数据之前的</span>sql<span style="font-family: 宋体">语句添加到</span>buffer<span style="font-family: 宋体">中，可用</span>sprintf<span style="font-family: 宋体">或</span>strcpy<span style="font-family: 宋体">等。</span></p>
<p style="text-indent: -18pt; margin-left: 39pt"><span>3、 </span><span style="font-family: 宋体">用</span>mysql_real_escape_string()<span style="font-family: 宋体">函数添加二进制数据到</span>buffer<span style="font-family: 宋体">中。</span></p>
<p style="text-indent: -18pt; margin-left: 39pt"><span>4、 </span><span style="font-family: 宋体">加上剩余的</span>sql<span style="font-family: 宋体">语句，形成完整的</span>sql<span style="font-family: 宋体">语句。</span></p>
<p style="text-indent: -18pt; margin-left: 39pt"><span>5、 </span><span style="font-family: 宋体">利用</span>mysql_real_query()<span style="font-family: 宋体">函数来执行</span>sql<span style="font-family: 宋体">语句。</span></p>
<p><span style="font-family: 宋体">具体代码如下：</span></p>
<p><span style="font-family: 宋体"><br /></span></p>
<p>
<table style="border-collapse: collapse" border="1" cellspacing="0" bordercolor="#999999" cellpadding="0" width="95%" bgcolor="#f1f1f1">
<tbody>
<tr>
<td>
<p style="line-height: 150%; margin: 5px"><code><span style="color: rgb(0,0,0)"><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdio<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdlib<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>mysql<span style="color: rgb(0,0,204)">/</span>mysql<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdint<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span><span style="color: rgb(255,0,0)">string</span><span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><br /><span style="color: rgb(0,0,255)">int</span> main<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,255)">int</span> argc<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,255)">char</span> <span style="color: rgb(0,0,204)">*</span>argv<span style="color: rgb(0,0,204)">[</span><span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br />MYSQL mysql<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">char</span> sql<span style="color: rgb(0,0,204)">[</span>256<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">*</span>end<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">int</span> index<span style="color: rgb(0,0,204)">,</span> i<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">uint32_t</span> <span style="color: rgb(0,0,204)">*</span>destIDs<span style="color: rgb(0,0,204)">;</span><br /><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>argc <span style="color: rgb(0,0,204)">!</span><span style="color: rgb(0,0,204)">=</span> 2<span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"enter error!\n"</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br />index <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">atoi</span><span style="color: rgb(0,0,204)">(</span>argv<span style="color: rgb(0,0,204)">[</span>1<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"index: %d\n"</span><span style="color: rgb(0,0,204)">,</span> index<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br />destIDs <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span> <span style="color: rgb(0,0,204)">*</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(255,0,0)">malloc</span><span style="color: rgb(0,0,204)">(</span>index <span style="color: rgb(0,0,204)">*</span> <span style="color: rgb(0,0,255)">sizeof</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>destIDs <span style="color: rgb(0,0,204)">=</span><span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"malloc error\n"</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">for</span><span style="color: rgb(0,0,204)">(</span>i<span style="color: rgb(0,0,204)">=</span>0<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">&lt;</span>index<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">)</span><br />destIDs<span style="color: rgb(0,0,204)">[</span>i<span style="color: rgb(0,0,204)">]</span> <span style="color: rgb(0,0,204)">=</span> i <span style="color: rgb(0,0,204)">+</span> 1<span style="color: rgb(0,0,204)">;</span><br />mysql_init<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">!</span><span style="color: rgb(0,0,204)">(</span>mysql_real_connect<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"localhost"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"root"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"654321"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"dbname"</span><span style="color: rgb(0,0,204)">,</span> 0<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">,</span> 0<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">fprintf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">stderr</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"Couldn't connect to engine!\n%s\n"</span><span style="color: rgb(0,0,204)">,</span> mysql_error<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">perror</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">""</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><br /><span style="color: rgb(255,0,0)">sprintf</span><span style="color: rgb(0,0,204)">(</span>sql<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"INSERT INTO Task(NumDest, DestIDs) VALUE (%u, "</span><span style="color: rgb(0,0,204)">,</span> index <span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br />end <span style="color: rgb(0,0,204)">=</span> sql <span style="color: rgb(0,0,204)">+</span> <span style="color: rgb(255,0,0)">strlen</span><span style="color: rgb(0,0,204)">(</span>sql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">*</span>end<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span> <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,255)">'\''</span><span style="color: rgb(0,0,204)">;</span><br />end <span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">=</span> mysql_real_escape_string<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">,</span> end<span style="color: rgb(0,0,204)">,</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,255)">char</span> <span style="color: rgb(0,0,204)">*</span><span style="color: rgb(0,0,204)">)</span>destIDs<span style="color: rgb(0,0,204)">,</span> index<span style="color: rgb(0,0,204)">*</span><span style="color: rgb(0,0,255)">sizeof</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">*</span>end<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span> <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,255)">'\''</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">*</span>end<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span> <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,255)">')'</span><span style="color: rgb(0,0,204)">;</span><br /><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"end - sql: %d\n"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,255)">unsigned</span> <span style="color: rgb(0,0,255)">int</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">(</span>end <span style="color: rgb(0,0,204)">-</span> sql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>mysql_real_query<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">,</span> sql<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,255)">unsigned</span> <span style="color: rgb(0,0,255)">int</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">(</span>end <span style="color: rgb(0,0,204)">-</span> sql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">fprintf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">stderr</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"Query failed (%s)\n"</span><span style="color: rgb(0,0,204)">,</span> mysql_error<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br />mysql_close<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>0<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">endif</span><br /><span style="color: rgb(0,0,255)">return</span> 0<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span></span></code></p></td></tr></tbody></table><br /><span style="font-weight: bold"><br /><br />--读取二进制文件--</span><br /></p>
<p><span style="font-family: 宋体">对于二进制文件的读取，也类似。</span></p>
<p><span style="font-family: 宋体">具体步骤：</span></p>
<p>1,<span style="font-family: 宋体">构造查询字串</span>. </p>
<p style="text-indent: 21pt">2,<span style="font-family: 宋体">执行</span>mysql _query<span style="font-family: 宋体">查询</span>. <span style="font-family: 宋体">（网上有说用</span>mysql_real_query<span style="font-family: 宋体">，未实验）</span></p>
<p style="text-indent: 21pt">3,<span style="font-family: 宋体">用</span>mysql_store_result<span style="font-family: 宋体">存储结果</span>. </p>
<p style="text-indent: 21pt">4,<span style="font-family: 宋体">用</span>mysql_fetch_row<span style="font-family: 宋体">取出一条记录处理</span>.</p>
<p><span style="font-family: 宋体">具体代码如下：</span></p>
<p><br />
<table style="border-collapse: collapse" border="1" cellspacing="0" bordercolor="#999999" cellpadding="0" width="95%" bgcolor="#f1f1f1">
<tbody>
<tr>
<td>
<p style="line-height: 150%; margin: 5px"><code><span style="color: rgb(0,0,0)"><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdio<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdlib<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>stdint<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span>mysql<span style="color: rgb(0,0,204)">/</span>mysql<span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><span style="color: rgb(0,0,204)">#</span><span style="color: rgb(255,0,0)">include</span> <span style="color: rgb(0,0,204)">&lt;</span><span style="color: rgb(255,0,0)">string</span><span style="color: rgb(0,0,204)">.</span>h<span style="color: rgb(0,0,204)">&gt;</span><br /><br /><span style="color: rgb(0,0,255)">int</span> main<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,255)">void</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(0,0,255)">int</span> ret<span style="color: rgb(0,0,204)">,</span> i<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">char</span> sql<span style="color: rgb(0,0,204)">[</span>256<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">;</span><br />MYSQL mysql<span style="color: rgb(0,0,204)">;</span><br />MYSQL_RES <span style="color: rgb(0,0,204)">*</span>result<span style="color: rgb(0,0,204)">;</span><br />MYSQL_ROW row<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">uint32_t</span> <span style="color: rgb(0,0,204)">*</span>destIDs<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">*</span>temp<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">unsigned</span> <span style="color: rgb(0,0,255)">int</span> destNum <span style="color: rgb(0,0,204)">=</span> 0<span style="color: rgb(0,0,204)">;</span><br /><br />mysql_init<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">!</span><span style="color: rgb(0,0,204)">(</span>mysql_real_connect<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"localhost"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"root"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"654321"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"dbname"</span><span style="color: rgb(0,0,204)">,</span> 0<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">,</span> 0<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">fprintf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">stderr</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"Couldn't connect to engine!\n%s\n"</span><span style="color: rgb(0,0,204)">,</span><br />mysql_error<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">perror</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">""</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><br /><span style="color: rgb(255,0,0)">sprintf</span><span style="color: rgb(0,0,204)">(</span>sql<span style="color: rgb(0,0,204)">,</span> <br /><span style="color: rgb(255,0,255)">"SELECT TaskID, NumDest, DestIDs FROM Task"</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br />ret <span style="color: rgb(0,0,204)">=</span> mysql_query<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">,</span> sql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>ret <span style="color: rgb(0,0,204)">!</span><span style="color: rgb(0,0,204)">=</span> 0<span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span> <span style="color: rgb(255,0,255)">"Failed to query task table: %s\n"</span><span style="color: rgb(0,0,204)">,</span><br />mysql_error<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">return</span> ret<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><br />result <span style="color: rgb(0,0,204)">=</span> mysql_store_result<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>result <span style="color: rgb(0,0,204)">=</span><span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br />ret <span style="color: rgb(0,0,204)">=</span> mysql_errno<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span> <span style="color: rgb(255,0,255)">"Failed to store query result from task table:%s\n"</span><span style="color: rgb(0,0,204)">,</span><br />mysql_error<span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">&amp;</span>mysql<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">return</span> ret<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(0,0,204)">(</span>row <span style="color: rgb(0,0,204)">=</span> mysql_fetch_row<span style="color: rgb(0,0,204)">(</span>result<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span> <span style="color: rgb(0,0,204)">!</span><span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">sscanf</span><span style="color: rgb(0,0,204)">(</span>row<span style="color: rgb(0,0,204)">[</span>1<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(255,0,255)">"%u"</span><span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">&amp;</span>destNum<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><br />destIDs <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span> <span style="color: rgb(0,0,204)">*</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(255,0,0)">malloc</span><span style="color: rgb(0,0,204)">(</span>destNum <span style="color: rgb(0,0,204)">*</span> <span style="color: rgb(0,0,255)">sizeof</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>destIDs <span style="color: rgb(0,0,204)">=</span><span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"malloc error!\n"</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><span style="color: rgb(255,0,0)">memcpy</span><span style="color: rgb(0,0,204)">(</span>destIDs<span style="color: rgb(0,0,204)">,</span> row<span style="color: rgb(0,0,204)">[</span>2<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">,</span> destNum <span style="color: rgb(0,0,204)">*</span> <span style="color: rgb(0,0,255)">sizeof</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span> <br /><span style="color: rgb(0,0,204)">}</span><br /><br />mysql_free_result<span style="color: rgb(0,0,204)">(</span>result<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"destNum: %d\n"</span><span style="color: rgb(0,0,204)">,</span> destNum<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br />temp <span style="color: rgb(0,0,204)">=</span> destIDs<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">for</span><span style="color: rgb(0,0,204)">(</span>i<span style="color: rgb(0,0,204)">=</span>0<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">&lt;</span>destNum<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"destIDs[%d]:%d\t"</span><span style="color: rgb(0,0,204)">,</span> i<span style="color: rgb(0,0,204)">+</span>1<span style="color: rgb(0,0,204)">,</span> <span style="color: rgb(0,0,204)">*</span>temp<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><br /><span style="color: rgb(0,0,255)">return</span> ret<span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /></span></code></p></td></tr></tbody></table><br /></p>
<p><span style="font-family: 宋体">由于我这里可以根据</span>NumDest<span style="font-family: 宋体">获取到二进制的长度，所以不用再用函数去获取。</span></p>
<p><span style="font-family: 宋体">据网上信息，获取二进制信息长度应该这样：&#8220;如果取出来的是二进制的数据</span>,<span style="font-family: 宋体">要确定它的长度</span>,<span style="font-family: 宋体">必须要用</span>mysql_fetch_lengths<span style="font-family: 宋体">函数取得其长度&#8221;</span></p>
<p><br />
<table style="border-collapse: collapse" border="1" cellspacing="0" bordercolor="#999999" cellpadding="0" width="95%" bgcolor="#f1f1f1">
<tbody>
<tr>
<td>
<p style="line-height: 150%; margin: 5px"><code><span style="color: rgb(0,0,0)"><span style="color: rgb(0,0,255)">int</span> num_fields <span style="color: rgb(0,0,204)">=</span> mysql_num_fields<span style="color: rgb(0,0,204)">(</span>result<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">unsigned</span> <span style="color: rgb(0,0,255)">long</span> <span style="color: rgb(0,0,204)">*</span>lengths <span style="color: rgb(0,0,204)">=</span> mysql_fetch_lengths<span style="color: rgb(0,0,204)">(</span>result<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">for</span><span style="color: rgb(0,0,204)">(</span>i<span style="color: rgb(0,0,204)">=</span>0<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">&lt;</span>num_fields<span style="color: rgb(0,0,204)">;</span> i<span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">+</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"Column: %u\t %lu bytes\n"</span><span style="color: rgb(0,0,204)">,</span> i<span style="color: rgb(0,0,204)">+</span>1<span style="color: rgb(0,0,204)">,</span> lengths<span style="color: rgb(0,0,204)">[</span>i<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br />destIDs <span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,0)">uint32_t</span> <span style="color: rgb(0,0,204)">*</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(255,0,0)">malloc</span><span style="color: rgb(0,0,204)">(</span>lengths<span style="color: rgb(0,0,204)">[</span>2<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,204)">(</span>destIDs <span style="color: rgb(0,0,204)">=</span><span style="color: rgb(0,0,204)">=</span> <span style="color: rgb(255,0,0)">NULL</span><span style="color: rgb(0,0,204)">)</span><br /><span style="color: rgb(0,0,204)">{</span><br /><span style="color: rgb(255,0,0)">printf</span><span style="color: rgb(0,0,204)">(</span><span style="color: rgb(255,0,255)">"malloc error!\n"</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(255,0,0)">exit</span><span style="color: rgb(0,0,204)">(</span>1<span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /><span style="color: rgb(0,0,204)">}</span><br /><span style="color: rgb(255,0,0)">memcpy</span><span style="color: rgb(0,0,204)">(</span>destIDs<span style="color: rgb(0,0,204)">,</span> row<span style="color: rgb(0,0,204)">[</span>2<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">,</span> lengths<span style="color: rgb(0,0,204)">[</span>2<span style="color: rgb(0,0,204)">]</span><span style="color: rgb(0,0,204)">)</span><span style="color: rgb(0,0,204)">;</span><br /></span></code></p></td></tr></tbody></table><br /><br /><br /><br />取二进制数据:</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">一样的sql语句，查询出来即可。只不过二进制数据是个数据块，需要得到数据块的大小和数据指针。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">bool CMySqlAccess::GetBinaryField(int nCol,char* &amp;pDataOut,int&amp; nDataLen)<br />{<br />if (m_ItemMySqlRow[nCol] != NULL)<br />{<br />unsigned long *FieldLength = mysql_fetch_lengths(m_pMySqlResult);<br />nDataLen = (int)FieldLength[nCol];<br />pDataOut = (char*)(m_ItemMySqlRow[nCol]);<br />return true;<br />}<br />else<br />{<br />return false;<br />}<br />}</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">像通常一样查询后，得到结果集，然后得到第nCol列结果，返回二进制指针结果和二进制长度。返回后必须立马处理或者存储一份。否则mysql将数据销毁，指针所指数据则无效了。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">存二进制数据:</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">mysql语句接受的sql语句都是string，以'\0'结尾的。如果冒然插入二进制数据到sql语句中，要么报错，要么存储错误。此处可以通过mysql提供的函数将数据转换一下即可。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">char* CMySqlAccess::ConvertBinaryToString(char* pBinaryData,int nLen)<br />{<br />static char s_BinaryData[10240];<br />mysql_real_escape_string(m_pMySqlConn,s_BinaryData,pBinaryData,nLen);<br />return s_BinaryData;<br />}<br />上面这个函数只能单线程使用啊，将一块二进制数据转换为mysql可识别的string数据。这样就直接可以通过mysql的sql语句insert，update来对blob数据进行更新和插入了，sql语句用法不变。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">用例：</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">std::ostringstream strSQL;<br />strSQL&lt;&lt;"INSERT INTO "&lt;&lt;m_strTableName&lt;&lt;"(roleid,playerdata,dynamicdata) VALUES("&lt;&lt;dwDBRoleID<br />&lt;&lt;",'"&lt;&lt;m_pDBAccess-&gt;ConvertBinaryToString(pData,nLen)&lt;&lt;"','')";<br />assert(m_pDBAccess);<br />m_pDBAccess-&gt;ExecuteSQL(strSQL.str());</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">playerdata是blob二进制类型，pData是指向一个结构体的指针，nLen是结构体的大小。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">上面就可以实现二进制的存储了。</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Times New Roman; font-size: 16px">方法二：</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">上面的方法，你会发现，你每次都需要转换数据，传指针，传大小等一系列复杂操作，是不是顺序很混乱，过程很繁杂。mysql也为你提供了另外一种方法，那就是MYSQL_BIND。将数据操作统一化，统一麻烦化。mysqlbind是一个结构体，根据个人不同需求填充各个数据成员可以存储任意类型数据，当然包括blob。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">bool CMySqlAccess::SetBinaryField(std::string&amp; strCondition,void* pDataIn,int nDataLen)<br />{<br />if( ! mysql_stmt_prepare( m_pMySqlStmt, strCondition.c_str(), strCondition.length() ) )<br />{<br />memset(&amp;m_MySqlBind,0,sizeof(MYSQL_BIND));<br />m_MySqlBind.buffer_type = MYSQL_TYPE_BLOB;<br />(*m_MySqlBind.length) = nDataLen;<br />memcpy(m_MySqlBind.buffer,pDataIn,nDataLen);<br />if(!mysql_stmt_bind_param(m_pMySqlStmt, (MYSQL_BIND *)&amp;m_MySqlBind))<br />{<br />if(!mysql_stmt_execute(m_pMySqlStmt)) <br />{<br />return true;<br />}<br />}<br />}<br />int nRes=GetDBErrorCode();<br />CLogOutStream errLog(crazy::ERROR_LEVEL,THIS_CLASS_NAME);<br />errLog&lt;&lt;"MySql Query Failed:\""&lt;&lt;strCondition&lt;&lt;"\" ,ErrorCode:"&lt;&lt;nRes&lt;&lt;crazy::logEnd;<br />return false;<br />}</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">这个是对某一列blob数据进行存操作。pDataIn和nDataLen分别是一个struct结构体和结构体大小。填充完毕mysqlbind之后即可对数据库二进制列进行存储了。可能你会问，没有指定哪一列呢，对。哪一列是在strCondition语句里面的，这是一个预处理语句。在预处理语句里面，有一个符号: ? 。问号，问号的位置代表了mysqlbind数据对应的位置。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">INSERT INTO test_table(date_field, time_field, timestamp_field) VALUES(?,?,?）</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">上面这个语句，有3个问号,三个问号分别对应test_table的三列.每个问号呢又对应一个mysqlbind数据结构。那么我们在mysql_stmt_bind_param函数调用时，就应该传入一个mysql_bind 数组。MYSQL_BIND m_MySqlBind[3].</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">填充整个数组数据，即对应三个问号内容。</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">用例：<br /><span style="background-color: rgb(49,106,197); color: rgb(255,255,255)">MYSQL_BIND</span> bind[3];<br />MYSQL_STMT *stmt;<br /><br />strmov(query, "INSERT INTO test_table(date_field, time_field, timestamp_field) VALUES(?,?,?");<br />//初始化stmt<br />stmt = mysql_stmt_init(mysql);<br />//预处理语句<br />mysql_stmt_prepare(mysql, query, strlen(query));<br />//初始化参数<br />bind[0].buffer_type= MYSQL_TYPE_DATE;<br />bind[0].buffer= (char *)&amp;ts;<br />bind[0].is_null= 0;<br />bind[0].length= 0;<br />bind[1]= bind[2]= bind[0];<br />//绑定参数123<br />mysql_stmt_bind_param(stmt, bind);<br />//执行预处理mysql语句<br />mysql_stmt_execute(stmt);</span></p>
<p><span style="font-family: Times New Roman; font-size: 16px">还没看懂就个人去看mysql文档了，其实里面讲得很清楚，只要找对几个函数，就可以把search出来了<br /><br />转自：<a href="http://blog.chinaunix.net/uid-23842323-id-2656614.html">http://blog.chinaunix.net/uid-23842323-id-2656614.html</a><br />Reference：<a href="http://topic.csdn.net/u/20090316/11/ac003f13-d1da-49a5-b12f-90e57cbe5ac9.html">http://topic.csdn.net/u/20090316/11/ac003f13-d1da-49a5-b12f-90e57cbe5ac9.html</a></span></p><img src ="http://www.cppblog.com/Daywei0123/aggbug/181479.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Daywei0123/" target="_blank">Daywei</a> 2012-07-05 16:06 <a href="http://www.cppblog.com/Daywei0123/archive/2012/07/05/181479.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>