热门关键字:  ubuntu  分区  Fedora  linux系统进程  函数

C++的berkeleydb简单例子

来源: 作者: 时间:2007-12-03 Tag: 点击:

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//only this head should include for use bdb.
#include "db_cxx.h"
#include "db.h"

int main()
{
//Creat and Open my_db.db
Db db(NULL, 0); // Instantiate the Db object
u_int32_t oFlags = DB_CREATE; // Open flags;
try {
// Open the database
db.open(NULL, // Transaction pointer
"my_db.db", // Database file name
  NULL, // Optional logical database name
  DB_BTREE, // Database access method
  oFlags, // Open flags
  0); // File mode (using defaults)
// DbException is not subclassed from std::exception, so
// need to catch both of these.
}
catch(DbException &e)
{
// Error handling code goes here
std::cerr << e.what() << std::endl;
}
catch(std::exception &e)
{
// Error handling code goes here
std::cerr << e.what() << std::endl;
}



相关文章:
SQLite3 C/C++ 开发接口简介(API函数) 二
SQLite3 使用教学
Scaling out MySQL - Hardware today and tomorro
SQLite适用的范围
sybase cursor declare
SQL语句大全精要
用户配额
decode函数
Oracle 数据库创建表空间、创建用户指定表空间
MySQL教会我使用GnuPG验证软件包
MySQL中MyISAM引擎与InnoDB引擎性能简单测试
initdb
mysqladmin在线帮助文档
CentOS 4.7 安装Oracle 9.2.0.4的一些问题
文本如何导入oracle(sqlldr 的用法)
ORA-00600: 内部错误代码,自变量: [16201], [],
分布式Oracle的database link
install a MySQL source distribution
Mysql备份脚本(未验证)
oracle 9.2.0.1 update 9.2.0.5
每小时Dump所有mysql数据库到NAS存储设备上
Oracle SCN机制解析
Account LOCKED(TIMED)
MySQL数据库5.0的my.cnf配置选项
oracle存储过程中调用其他用户的表
修改sqlplus提示符
MYSQL建表实例
一些对Mysql DBA有用的脚本
Oracle DBA 强悍挑战OS 64位 Solaris 10-真正休
[Bugzilla]由Mysql迁移到Oracle的方法