<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：Berkeley DB 批量插入更新与删除用法示例</title>
	<atom:link href="http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/</link>
	<description>Oracle Berkeley DB 中国研发团队的博客</description>
	<lastBuildDate>Thu, 15 Dec 2011 10:53:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-2097</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Fri, 28 Jan 2011 07:37:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-2097</guid>
		<description>&lt;a href=&quot;#comment-2075&quot; rel=&quot;nofollow&quot;&gt;@tiplip &lt;/a&gt; 
Bogdan 于Jan 27, 2011 10:04 AM在OTN论坛的回复应该已经回答你的问题了。

简单来说，我们建议你在topic的forumID和dateOfLastReply两个字段建立复合索引(即Secondary Index or Secondary Database)。需要查询最新25个topic时，在Secondary Database上打开一个Cursor，然后将cursor对应到forunID=xx那些记录（通过设置DB_SET_RANGE来实现）。然后通过DB_NEXT循环输出。

注意：在建立Secondary Database时，针对dateOfLastReply字段的比较函数必须是倒序，这样才能把最新的回复排在最前面。</description>
		<content:encoded><![CDATA[<p><a href="#comment-2075" rel="nofollow">@tiplip </a><br />
Bogdan 于Jan 27, 2011 10:04 AM在OTN论坛的回复应该已经回答你的问题了。</p>
<p>简单来说，我们建议你在topic的forumID和dateOfLastReply两个字段建立复合索引(即Secondary Index or Secondary Database)。需要查询最新25个topic时，在Secondary Database上打开一个Cursor，然后将cursor对应到forunID=xx那些记录（通过设置DB_SET_RANGE来实现）。然后通过DB_NEXT循环输出。</p>
<p>注意：在建立Secondary Database时，针对dateOfLastReply字段的比较函数必须是倒序，这样才能把最新的回复排在最前面。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：傅翠云</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-2096</link>
		<dc:creator>傅翠云</dc:creator>
		<pubDate>Fri, 28 Jan 2011 06:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-2096</guid>
		<description>OTN forum上已经有专家回答了你的问题，请参见http://forums.oracle.com/forums/thread.jspa?threadID=2162345&amp;tstart=0。

如果你觉得他的回答正确或者有帮助，请标识他的答复。

如果你还有其他问题，欢迎继续提问，谢谢。</description>
		<content:encoded><![CDATA[<p>OTN forum上已经有专家回答了你的问题，请参见http://forums.oracle.com/forums/thread.jspa?threadID=2162345&amp;tstart=0。</p>
<p>如果你觉得他的回答正确或者有帮助，请标识他的答复。</p>
<p>如果你还有其他问题，欢迎继续提问，谢谢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：tiplip</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-2075</link>
		<dc:creator>tiplip</dc:creator>
		<pubDate>Wed, 26 Jan 2011 06:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-2075</guid>
		<description>hi, 我在bdb forums中问过问题，可惜没人回答，可能是我表述不清，这里用中文再问一次，希望没有冒犯:)
http://forums.oracle.com/forums/thread.jspa?threadID=2162345&amp;tstart=0
我在用BDB（C API非SQL版）作为一个小BBS的后台数据库，这是个多线程程序，有forum/topic/post三个数据库，当选择一个forum进入时，该forum的topic按其回帖时间降序排列，与其他BBS一样，如果topic较多时，第一页之显示最新回贴的前25个topic，当有用户翻看第2个25个回帖时，则从数据库中重新取得符合条件的25个topic，以此类推...
struct forum {
UInt16 forumID;
string forumName;
string lastPoster; // who is the last one replied in this forum
};

struct topic {
UInt32 topicID;
UInt16 forumID; // topic comes from this forum
string title; // topic title
UInt64 dateOfLastReply; // when last reply to this topic happen
};

struct post {
UInt64 postID;
UInt32 topicID; // post comes from this topic
string title; // post title as of topic
UInt64 dateOfPost; // when this post is created
};
我是这么想的：给topic主数据库（topic id为主键）建两个secondary数据库，分别以forum id和dateOfLastReply为次键并且对次键进行排序，当有需要显示最新的前25个topic时，先从数据库中获取同forumid并按回帖排序的所有topic id，取前25个id再从数据库中获取这些id对应的data显示，当用户翻页时，重复上述动作，使用SQL描述，类似SELECT topicID FROM topic WHERE forumID=xx ORDER BY dateOfLastReply DESC

请问我该如何设计使用BDB才能效率最高？</description>
		<content:encoded><![CDATA[<p>hi, 我在bdb forums中问过问题，可惜没人回答，可能是我表述不清，这里用中文再问一次，希望没有冒犯:)<br />
<a href="http://forums.oracle.com/forums/thread.jspa?threadID=2162345&amp;tstart=0" rel="nofollow">http://forums.oracle.com/forums/thread.jspa?threadID=2162345&amp;tstart=0</a><br />
我在用BDB（C API非SQL版）作为一个小BBS的后台数据库，这是个多线程程序，有forum/topic/post三个数据库，当选择一个forum进入时，该forum的topic按其回帖时间降序排列，与其他BBS一样，如果topic较多时，第一页之显示最新回贴的前25个topic，当有用户翻看第2个25个回帖时，则从数据库中重新取得符合条件的25个topic，以此类推&#8230;<br />
struct forum {<br />
UInt16 forumID;<br />
string forumName;<br />
string lastPoster; // who is the last one replied in this forum<br />
};</p>
<p>struct topic {<br />
UInt32 topicID;<br />
UInt16 forumID; // topic comes from this forum<br />
string title; // topic title<br />
UInt64 dateOfLastReply; // when last reply to this topic happen<br />
};</p>
<p>struct post {<br />
UInt64 postID;<br />
UInt32 topicID; // post comes from this topic<br />
string title; // post title as of topic<br />
UInt64 dateOfPost; // when this post is created<br />
};<br />
我是这么想的：给topic主数据库（topic id为主键）建两个secondary数据库，分别以forum id和dateOfLastReply为次键并且对次键进行排序，当有需要显示最新的前25个topic时，先从数据库中获取同forumid并按回帖排序的所有topic id，取前25个id再从数据库中获取这些id对应的data显示，当用户翻页时，重复上述动作，使用SQL描述，类似SELECT topicID FROM topic WHERE forumID=xx ORDER BY dateOfLastReply DESC</p>
<p>请问我该如何设计使用BDB才能效率最高？</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：ardan</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-1579</link>
		<dc:creator>ardan</dc:creator>
		<pubDate>Fri, 26 Nov 2010 12:42:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-1579</guid>
		<description>你好，我在VC6.0下调用的BerkeleyDB，每次我在dbp-&gt;open的参数中写入事务的指针的时候，都会报错，invalid argument。我仔细的检查过我用到的函数，都没有错误，如果在dbp-&gt;open中事务的指针为NULL时，数据就都可以写进去的。还有我在写程序的时候发现一下几个问题。1、当存入的数据有相同的key就会报错，怎么可以写入相同的key呢。2、我做了一个时间的测试，发现写入txt的速度比写入数据库的速度快很多，理论上应该蛮快的呀，这个问题要怎么解决呢。3、我写入数据只有4000k，写到数据库却有6000多k。期待您的回答。谢谢～</description>
		<content:encoded><![CDATA[<p>你好，我在VC6.0下调用的BerkeleyDB，每次我在dbp-&gt;open的参数中写入事务的指针的时候，都会报错，invalid argument。我仔细的检查过我用到的函数，都没有错误，如果在dbp-&gt;open中事务的指针为NULL时，数据就都可以写进去的。还有我在写程序的时候发现一下几个问题。1、当存入的数据有相同的key就会报错，怎么可以写入相同的key呢。2、我做了一个时间的测试，发现写入txt的速度比写入数据库的速度快很多，理论上应该蛮快的呀，这个问题要怎么解决呢。3、我写入数据只有4000k，写到数据库却有6000多k。期待您的回答。谢谢～</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-1533</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Thu, 18 Nov 2010 04:55:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-1533</guid>
		<description>&lt;a href=&quot;#comment-1471&quot; rel=&quot;nofollow&quot;&gt;@cc &lt;/a&gt; 
如果你仔细读完BDB的文档和相关示例的话，我相信你一定可以找到答案的。毕竟，你的问题都是常识性的东西。如果再有困难，欢迎给我发邮件。</description>
		<content:encoded><![CDATA[<p><a href="#comment-1471" rel="nofollow">@cc </a><br />
如果你仔细读完BDB的文档和相关示例的话，我相信你一定可以找到答案的。毕竟，你的问题都是常识性的东西。如果再有困难，欢迎给我发邮件。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：cc</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-1471</link>
		<dc:creator>cc</dc:creator>
		<pubDate>Sun, 07 Nov 2010 03:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-1471</guid>
		<description>你好，请问如何将连续接收的数据保存在DB。我用的MFC，其线程函数接收到数据就存入到数据库，已有数据来就触发线程接收。数据是字符串。不知道要怎么弄啊。主要是用DB_MULTIPLE时，要用到 DbMultipleDataBuilder 这一块不太懂。望指教，单个的数据接收可以实现。</description>
		<content:encoded><![CDATA[<p>你好，请问如何将连续接收的数据保存在DB。我用的MFC，其线程函数接收到数据就存入到数据库，已有数据来就触发线程接收。数据是字符串。不知道要怎么弄啊。主要是用DB_MULTIPLE时，要用到 DbMultipleDataBuilder 这一块不太懂。望指教，单个的数据接收可以实现。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：cc</title>
		<link>http://www.bdbchina.com/2010/03/berkeley-db-%e6%89%b9%e9%87%8f%e6%8f%92%e5%85%a5%e6%9b%b4%e6%96%b0%e4%b8%8e%e5%88%a0%e9%99%a4%e7%94%a8%e6%b3%95%e7%a4%ba%e4%be%8b/comment-page-1/#comment-1469</link>
		<dc:creator>cc</dc:creator>
		<pubDate>Sat, 06 Nov 2010 15:39:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=815#comment-1469</guid>
		<description>你好，我现在的实验要用到Berkeley DB , 用的是MFC 。A 机器发数据，B 机器接收数据，要将B接收的数据连续保存起来（A发一个，B接收一个）。B 接收的数据为字符串。接收的数据有可能重复。接收的数据中key都相同，data不同（都是字符串）。应该怎么弄啊。 还有就是存入接收的数据之后，我通过按钮触发要显示这些数据，在触发函数中要怎么全部获得这些数据。   单个数据的存与取已经实现。       还有一个问题就是，建立数据库时大小为16KB 为何存入一个或两个数据后还是16KB
                                                                                                               期待你的回答！！！</description>
		<content:encoded><![CDATA[<p>你好，我现在的实验要用到Berkeley DB , 用的是MFC 。A 机器发数据，B 机器接收数据，要将B接收的数据连续保存起来（A发一个，B接收一个）。B 接收的数据为字符串。接收的数据有可能重复。接收的数据中key都相同，data不同（都是字符串）。应该怎么弄啊。 还有就是存入接收的数据之后，我通过按钮触发要显示这些数据，在触发函数中要怎么全部获得这些数据。   单个数据的存与取已经实现。       还有一个问题就是，建立数据库时大小为16KB 为何存入一个或两个数据后还是16KB<br />
                                                                                                               期待你的回答！！！</p>
]]></content:encoded>
	</item>
</channel>
</rss>
Դ
