Oracle Berkeley DB
Berkeley DB
API Reference
for C
11g Release 2
Library Version 11.2.5.2
Legal Notice
This documentation is distributed under an open source license. You may review the terms of this license at: http://
www.oracle.com/technetwork/database/berkeleydb/downloads/oslicense-093458.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.
Other names may be trademarks of their respective owners.
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 9/14/2011
9/14/2011
DB C API Page iii
Table of Contents
Preface ..................................................................................................... xiii
Conventions Used in this Book .................................................................. xiv
For More Information .............................................................................. xv
1. Introduction to Berkeley DB APIs .................................................................... 1
2. The DB Handle ......................................................................................... 2
Database and Related Methods .................................................................... 3
DB->associate() ....................................................................................... 6
DB->associate_foreign() ........................................................................... 10
DB->close() .......................................................................................... 13
DB->compact() ...................................................................................... 16
db_copy .............................................................................................. 20
db_create ............................................................................................ 21
DB->del() ............................................................................................. 23
DB->err() ............................................................................................. 26
DB->exists() .......................................................................................... 28
DB->fd() .............................................................................................. 30
DB->get() ............................................................................................. 31
DB->get_bt_minkey() ............................................................................... 36
DB->get_byteswapped() ........................................................................... 37
DB->get_cachesize() ............................................................................... 38
DB->get_create_dir() ............................................................................... 39
DB->get_dbname() .................................................................................. 40
DB->get_encrypt_flags() ........................................................................... 41
DB->get_errfile() .................................................................................... 42
DB->get_errpfx() .................................................................................... 43
DB->get_flags() ..................................................................................... 44
DB->get_h_ffactor() ................................................................................ 45
DB->get_h_nelem() ................................................................................. 46
DB->get_heapsize() ................................................................................. 47
DB->get_lorder() .................................................................................... 48
DB->get_msgfile() .................................................................................. 49
DB->get_multiple() ................................................................................. 50
DB->get_open_flags() .............................................................................. 51
DB->get_partition_callback() ..................................................................... 52
DB->get_partition_dirs() ........................................................................... 53
DB->get_partition_keys() .......................................................................... 54
DB->get_pagesize() ................................................................................. 55
DB->get_priority() .................................................................................. 56
DB->get_q_extentsize() ............................................................................ 57
DB->get_re_delim() ................................................................................ 58
DB->get_re_len() ................................................................................... 59
DB->get_re_pad() ................................................................................... 60
DB->get_re_source() ............................................................................... 61
DB->get_type() ...................................................................................... 62
DB->join() ............................................................................................ 63
DB->key_range() .................................................................................... 66
9/14/2011
DB C API Page iv
DB->open() ........................................................................................... 68
DB->put() ............................................................................................ 73
DB->remove() ....................................................................................... 77
DB->rename() ....................................................................................... 79
DB->set_alloc() ...................................................................................... 81
DB->set_append_recno() .......................................................................... 83
DB->set_bt_compare() ............................................................................. 85
DB->set_bt_compress() ............................................................................ 87
DB->set_bt_minkey() ............................................................................... 90
DB->set_bt_prefix() ................................................................................ 91
DB->set_cachesize() ................................................................................ 93
DB->set_create_dir() ............................................................................... 95
DB->set_dup_compare() ........................................................................... 96
DB->set_encrypt() .................................................................................. 98
DB->set_errcall() ................................................................................... 99
DB->set_errfile() .................................................................................. 101
DB->set_errpfx() ................................................................................... 103
DB->set_feedback() ............................................................................... 104
DB->set_flags() .................................................................................... 106
DB->set_h_compare() ............................................................................. 112
DB->set_h_ffactor() ............................................................................... 114
DB->set_h_hash() .................................................................................. 115
DB->set_h_nelem() ................................................................................ 116
DB->set_heapsize() ................................................................................ 117
DB->set_lorder() ................................................................................... 119
DB->set_msgcall() ................................................................................. 120
DB->set_msgfile() ................................................................................. 122
DB->set_pagesize() ................................................................................ 123
DB->set_partition() ............................................................................... 124
DB->set_partition_dirs() .......................................................................... 126
DB->set_priority() ................................................................................. 127
DB->set_q_extentsize() ........................................................................... 128
DB->set_re_delim() ............................................................................... 129
DB->set_re_len() .................................................................................. 130
DB->set_re_pad() .................................................................................. 131
DB->set_re_source() .............................................................................. 132
DB->stat() .......................................................................................... 134
DB->stat_print() ................................................................................... 142
DB->sync() .......................................................................................... 143
DB->truncate() ..................................................................................... 145
DB->upgrade() ..................................................................................... 147
DB->verify() ........................................................................................ 149
DB_HEAP_RID ...................................................................................... 152
3. The DBcursor Handle ............................................................................... 153
Database Cursors and Related Methods ....................................................... 154
DB->cursor() ........................................................................................ 155
DBcursor->close() ................................................................................. 157
DBcursor->cmp() ................................................................................... 158
DBcursor->count() ................................................................................. 159