Oracle Berkeley DB
Berkeley DB
API Reference
for C
11g Release 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/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.
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 3/30/2010
3/30/2010
DB C API Page iii
Table of Contents
Preface ..................................................................................................... xii
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_create ............................................................................................ 16
DB->compact() ...................................................................................... 18
DB->del() ............................................................................................. 22
DB->err() ............................................................................................. 25
DB->exists() .......................................................................................... 27
DB->fd() .............................................................................................. 29
DB->get() ............................................................................................. 30
DB->get_bt_minkey() ............................................................................... 35
DB->get_byteswapped() ........................................................................... 36
DB->get_cachesize() ............................................................................... 37
DB->get_create_dir() ............................................................................... 38
DB->get_dbname() .................................................................................. 39
DB->get_encrypt_flags() ........................................................................... 40
DB->get_errfile() .................................................................................... 41
DB->get_errpfx() .................................................................................... 42
DB->get_flags() ..................................................................................... 43
DB->get_h_ffactor() ................................................................................ 44
DB->get_h_nelem() ................................................................................. 45
DB->get_lorder() .................................................................................... 46
DB->get_msgfile() .................................................................................. 47
DB->get_multiple() ................................................................................. 48
DB->get_open_flags() .............................................................................. 49
DB->get_partition_callback() ..................................................................... 50
DB->get_partition_dirs() ........................................................................... 51
DB->get_partition_keys() .......................................................................... 52
DB->get_pagesize() ................................................................................. 53
DB->get_priority() .................................................................................. 54
DB->get_q_extentsize() ............................................................................ 55
DB->get_re_delim() ................................................................................ 56
DB->get_re_len() ................................................................................... 57
DB->get_re_pad() ................................................................................... 58
DB->get_re_source() ............................................................................... 59
DB->get_type() ...................................................................................... 60
DB->join() ............................................................................................ 61
DB->key_range() .................................................................................... 64
DB->open() ........................................................................................... 66
DB->put() ............................................................................................ 71
DB->remove() ....................................................................................... 75
DB->rename() ....................................................................................... 77
3/30/2010
DB C API Page iv
DB->set_alloc() ...................................................................................... 79
DB->set_append_recno() .......................................................................... 81
DB->set_bt_compare() ............................................................................. 83
DB->set_bt_compress() ............................................................................ 85
DB->set_bt_minkey() ............................................................................... 88
DB->set_bt_prefix() ................................................................................ 89
DB->set_cachesize() ................................................................................ 91
DB->set_create_dir() ............................................................................... 93
DB->set_dup_compare() ........................................................................... 94
DB->set_encrypt() .................................................................................. 96
DB->set_errcall() ................................................................................... 97
DB->set_errfile() .................................................................................... 99
DB->set_errpfx() ................................................................................... 101
DB->set_feedback() ............................................................................... 102
DB->set_flags() .................................................................................... 104
DB->set_h_compare() ............................................................................. 110
DB->set_h_ffactor() ............................................................................... 112
DB->set_h_hash() .................................................................................. 113
DB->set_h_nelem() ................................................................................ 114
DB->set_lorder() ................................................................................... 115
DB->set_msgcall() ................................................................................. 116
DB->set_msgfile() ................................................................................. 118
DB->set_pagesize() ................................................................................ 119
DB->set_partition() ............................................................................... 120
DB->set_partition_dirs() .......................................................................... 122
DB->set_priority() ................................................................................. 123
DB->set_q_extentsize() ........................................................................... 124
DB->set_re_delim() ............................................................................... 125
DB->set_re_len() .................................................................................. 126
DB->set_re_pad() .................................................................................. 127
DB->set_re_source() .............................................................................. 128
DB->stat() .......................................................................................... 130
DB->stat_print() ................................................................................... 137
DB->sync() .......................................................................................... 138
DB->truncate() ..................................................................................... 140
DB->upgrade() ..................................................................................... 142
DB->verify() ........................................................................................ 144
3. The DBcursor Handle ............................................................................... 147
Database Cursors and Related Methods ....................................................... 148
DB->cursor() ........................................................................................ 149
DBcursor->close() ................................................................................. 151
DBcursor->cmp() ................................................................................... 152
DBcursor->count() ................................................................................. 153
DBcursor->del() .................................................................................... 154
DBcursor->dup() ................................................................................... 156
DBcursor->get() .................................................................................... 158
DBcursor->get_priority() ......................................................................... 166
DBcursor->put() .................................................................................... 167
DBcursor->set_priority() .......................................................................... 171