没有合适的资源?快使用搜索试试~ 我知道了~
首页Berkley DB 参考手册(PDF版本)
资源详情
资源评论
资源推荐
Oracle Berkeley DB
Getting Started with
Berkeley DB
for C++
Release 4.8
.
Legal Notice
This documentation is distributed under an open source license. You may review the terms of this license at:
http://www.oracle.com/technology/software/products/berkeley-db/htdocs/oslicense.html
Oracle, Berkeley DB, and Sleepycat are trademarks or registered trademarks of Oracle. All rights to these marks are reserved. No
third-party use is permitted without the express prior written consent of Oracle.
To obtain a copy of this document's original source code, please submit a request to the Oracle Technology Network forum at:
http://forums.oracle.com/forums/forum.jspa?forumID=271
Published 8/14/2009
TableofContents
Preface ..................................................................................................... iv
Conventions Used in this Book ................................................................... iv
For More Information ........................................................................ v
1. Introduction to Berkeley DB ......................................................................... 1
About This Manual .................................................................................. 2
Berkeley DB Concepts .............................................................................. 2
Access Methods ..................................................................................... 4
Selecting Access Methods ................................................................... 4
Choosing between BTree and Hash ........................................................ 5
Choosing between Queue and Recno ...................................................... 5
Database Limits and Portability .................................................................. 6
Environments ........................................................................................ 6
Exception Handling ................................................................................. 7
Error Returns ........................................................................................ 8
Getting and Using DB .............................................................................. 8
2. Databases ............................................................................................... 9
Opening Databases ................................................................................. 9
Closing Databases ................................................................................. 10
Database Open Flags .............................................................................. 11
Administrative Methods .......................................................................... 11
Error Reporting Functions ........................................................................ 13
Managing Databases in Environments .......................................................... 15
Database Example ................................................................................. 17
3. Database Records ..................................................................................... 20
Using Database Records .......................................................................... 20
Reading and Writing Database Records ........................................................ 21
Writing Records to the Database ......................................................... 21
Getting Records from the Database ..................................................... 22
Deleting Records ............................................................................ 23
Data Persistence ............................................................................ 23
Database Usage Example ......................................................................... 24
4. Using Cursors .......................................................................................... 33
Opening and Closing Cursors ..................................................................... 33
Getting Records Using the Cursor ............................................................... 34
Searching for Records ...................................................................... 35
Working with Duplicate Records .......................................................... 38
Putting Records Using Cursors ................................................................... 40
Deleting Records Using Cursors ................................................................. 42
Replacing Records Using Cursors ................................................................ 43
Cursor Example .................................................................................... 44
5. Secondary Databases ................................................................................. 48
Opening and Closing Secondary Databases .................................................... 48
Implementing Key Extractors ................................................................... 50
Working with Multiple Keys ............................................................... 51
Reading Secondary Databases ................................................................... 52
Deleting Secondary Database Records ......................................................... 53
Page iiGetting Started with DB8/14/2009
Using Cursors with Secondary Databases ..................................................... 54
Database Joins ..................................................................................... 55
Using Join Cursors .......................................................................... 56
Secondary Database Example ................................................................... 58
Secondary Databases with example_database_load .................................. 58
Secondary Databases with example_database_read .................................. 63
6. Database Configuration .............................................................................. 67
Setting the Page Size ............................................................................. 67
Overflow Pages .............................................................................. 67
Locking ....................................................................................... 68
IO Efficiency ................................................................................. 68
Page Sizing Advice .......................................................................... 69
Selecting the Cache Size ......................................................................... 70
BTree Configuration .............................................................................. 70
Allowing Duplicate Records ............................................................... 71
Sorted Duplicates .................................................................... 71
Unsorted Duplicates ................................................................. 71
Configuring a Database to Support Duplicates ................................... 72
Setting Comparison Functions ............................................................ 73
Creating Comparison Functions ................................................... 74
Page iiiGetting Started with DB8/14/2009
Preface
Welcome to Berkeley DB (DB). This document introduces DB, version 4.8. It is intended to
provide a rapid introduction to the DB API set and related concepts. The goal of this document
is to provide you with an efficient mechanism with which you can evaluate DB against your
project's technical requirements. As such, this document is intended for C++ developers and
senior software architects who are looking for an in-process data management solution. No
prior experience with Berkeley DB is expected or required.
ConventionsUsedinthisBook
The following typographical conventions are used within in this manual:
Class names are represented in
monospaced font
, as are
method names
. For example: "
Db::open()
is a
Db
class method."
Variable or non-literal text is presented in italics. For example: "Go to your DB_INSTALL
directory."
Program examples are displayed in a
monospaced font
on a shaded background. For example:
typedef struct vendor {
char name[MAXFIELD]; // Vendor name
char street[MAXFIELD]; // Street name and number
char city[MAXFIELD]; // City
char state[3]; // Two-digit US state code
char zipcode[6]; // US zipcode
char phone_number[13]; // Vendor phone number
} VENDOR;
In some situations, programming examples are updated from one chapter to the next. When
this occurs, the new code is presented in
monospaced bold
font. For example:
typedef struct vendor {
char name[MAXFIELD]; // Vendor name
char street[MAXFIELD]; // Street name and number
char city[MAXFIELD]; // City
char state[3]; // Two-digit US state code
char zipcode[6]; // US zipcode
char phone_number[13]; // Vendor phone number
char sales_rep[MAXFIELD]; // Name of sales representative
char sales_rep_phone[MAXFIELD]; // Sales rep's phone number
} VENDOR;
Finally, notes of interest are represented using a note block such as this.
☞
Page ivGetting Started with DB8/14/2009
剩余80页未读,继续阅读
sangjinguang0903
- 粉丝: 14
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论3