… | |
… | |
111 | In the following, $int signifies an integer return value, "bdb_filename" |
111 | In the following, $int signifies an integer return value, "bdb_filename" |
112 | is a "filename" (octets on unix, madness on windows), "U32" is an |
112 | is a "filename" (octets on unix, madness on windows), "U32" is an |
113 | unsigned 32 bit integer, "int" is some integer, "NV" is a floating point |
113 | unsigned 32 bit integer, "int" is some integer, "NV" is a floating point |
114 | value. |
114 | value. |
115 | |
115 | |
116 | The "SV *" types are generic perl scalars (for input and output of data |
116 | Most "SV *" types are generic perl scalars (for input and output of data |
117 | values), and the "SV *callback" is the optional callback function to |
117 | values). |
118 | call when the request is completed. |
|
|
119 | |
118 | |
120 | The various "DB_ENV" etc. arguments are handles return by |
119 | The various "DB_ENV" etc. arguments are handles return by |
121 | "db_env_create", "db_create", "txn_begin" and so on. If they have an |
120 | "db_env_create", "db_create", "txn_begin" and so on. If they have an |
122 | appended "_ornull" this means they are optional and you can pass "undef" |
121 | appended "_ornull" this means they are optional and you can pass "undef" |
123 | for them, resulting a NULL pointer on the C level. |
122 | for them, resulting a NULL pointer on the C level. |
|
|
123 | |
|
|
124 | The "SV *callback" is the optional callback function to call when the |
|
|
125 | request is completed. This last callback argument is special: the |
|
|
126 | callback is simply the last argument passed. If there are "optional" |
|
|
127 | arguments before the callback they can be left out. The callback itself |
|
|
128 | can be left out or specified as "undef", in which case the function will |
|
|
129 | be executed synchronously. |
|
|
130 | |
|
|
131 | For example, "db_env_txn_checkpoint" usually is called with all integer |
|
|
132 | arguments zero. These can be left out, so all of these specify a call to |
|
|
133 | "DB_ENV->txn_checkpoint", to be executed asynchronously with a callback |
|
|
134 | to be called: |
|
|
135 | |
|
|
136 | db_env_txn_checkpoint $db_env, 0, 0, 0, sub { }; |
|
|
137 | db_env_txn_checkpoint $db_env, 0, 0, sub { }; |
|
|
138 | db_env_txn_checkpoint $db_env, sub { }; |
|
|
139 | |
|
|
140 | While these all specify a call to "DB_ENV->txn_checkpoint" to be |
|
|
141 | executed synchronously: |
|
|
142 | |
|
|
143 | db_env_txn_checkpoint $db_env, 0, 0, 0, undef; |
|
|
144 | db_env_txn_checkpoint $db_env, 0, 0, 0; |
|
|
145 | db_env_txn_checkpoint $db_env, 0; |
124 | |
146 | |
125 | BDB functions |
147 | BDB functions |
126 | Functions in the BDB namespace, exported by default: |
148 | Functions in the BDB namespace, exported by default: |
127 | |
149 | |
128 | $env = db_env_create (U32 env_flags = 0) |
150 | $env = db_env_create (U32 env_flags = 0) |
… | |
… | |
152 | flags: FREELIST_ONLY FREE_SPACE |
174 | flags: FREELIST_ONLY FREE_SPACE |
153 | db_sync (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef) |
175 | db_sync (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef) |
154 | db_key_range (DB *db, DB_TXN_ornull *txn, SV *key, SV *key_range, U32 flags = 0, SV *callback = &PL_sv_undef) |
176 | db_key_range (DB *db, DB_TXN_ornull *txn, SV *key, SV *key_range, U32 flags = 0, SV *callback = &PL_sv_undef) |
155 | db_put (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
177 | db_put (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
156 | flags: APPEND NODUPDATA NOOVERWRITE |
178 | flags: APPEND NODUPDATA NOOVERWRITE |
|
|
179 | db_exists (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = 0) (v4.6) |
157 | db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
180 | db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
158 | flags: CONSUME CONSUME_WAIT GET_BOTH SET_RECNO MULTIPLE READ_COMMITTED READ_UNCOMMITTED RMW |
181 | flags: CONSUME CONSUME_WAIT GET_BOTH SET_RECNO MULTIPLE READ_COMMITTED READ_UNCOMMITTED RMW |
159 | db_pget (DB *db, DB_TXN_ornull *txn, SV *key, SV *pkey, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
182 | db_pget (DB *db, DB_TXN_ornull *txn, SV *key, SV *pkey, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) |
160 | flags: CONSUME CONSUME_WAIT GET_BOTH SET_RECNO MULTIPLE READ_COMMITTED READ_UNCOMMITTED RMW |
183 | flags: CONSUME CONSUME_WAIT GET_BOTH SET_RECNO MULTIPLE READ_COMMITTED READ_UNCOMMITTED RMW |
161 | db_del (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = &PL_sv_undef) |
184 | db_del (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = &PL_sv_undef) |
… | |
… | |
227 | $int = $env->set_tmp_dir (const char *dir) |
250 | $int = $env->set_tmp_dir (const char *dir) |
228 | $int = $env->set_lg_dir (const char *dir) |
251 | $int = $env->set_lg_dir (const char *dir) |
229 | $int = $env->set_shm_key (long shm_key) |
252 | $int = $env->set_shm_key (long shm_key) |
230 | $int = $env->set_cachesize (U32 gbytes, U32 bytes, int ncache = 0) |
253 | $int = $env->set_cachesize (U32 gbytes, U32 bytes, int ncache = 0) |
231 | $int = $env->set_flags (U32 flags, int onoff = 1) |
254 | $int = $env->set_flags (U32 flags, int onoff = 1) |
232 | $int = $env->log_set_config (U32 flags, int onoff = 1) [v4.7] |
255 | $int = $env->log_set_config (U32 flags, int onoff = 1) (v4.7) |
233 | $int = $env->set_intermediate_dir_mode (const char *modestring) [v4.7] |
256 | $int = $env->set_intermediate_dir_mode (const char *modestring) (v4.7) |
234 | $env->set_errfile (FILE *errfile = 0) |
257 | $env->set_errfile (FILE *errfile = 0) |
235 | $env->set_msgfile (FILE *msgfile = 0) |
258 | $env->set_msgfile (FILE *msgfile = 0) |
236 | $int = $env->set_verbose (U32 which, int onoff = 1) |
259 | $int = $env->set_verbose (U32 which, int onoff = 1) |
237 | $int = $env->set_encrypt (const char *password, U32 flags = 0) |
260 | $int = $env->set_encrypt (const char *password, U32 flags = 0) |
238 | $int = $env->set_timeout (NV timeout_seconds, U32 flags = SET_TXN_TIMEOUT) |
261 | $int = $env->set_timeout (NV timeout_seconds, U32 flags = SET_TXN_TIMEOUT) |
… | |
… | |
250 | $int = $env->mutex_set_max (U32 max) |
273 | $int = $env->mutex_set_max (U32 max) |
251 | $int = $env->mutex_set_align (U32 align) |
274 | $int = $env->mutex_set_align (U32 align) |
252 | |
275 | |
253 | $txn = $env->txn_begin (DB_TXN_ornull *parent = 0, U32 flags = 0) |
276 | $txn = $env->txn_begin (DB_TXN_ornull *parent = 0, U32 flags = 0) |
254 | flags: READ_COMMITTED READ_UNCOMMITTED TXN_NOSYNC TXN_NOWAIT TXN_SNAPSHOT TXN_SYNC TXN_WAIT TXN_WRITE_NOSYNC |
277 | flags: READ_COMMITTED READ_UNCOMMITTED TXN_NOSYNC TXN_NOWAIT TXN_SNAPSHOT TXN_SYNC TXN_WAIT TXN_WRITE_NOSYNC |
|
|
278 | $txn = $env->cdsgroup_begin; (v4.5) |
255 | |
279 | |
256 | Example: |
280 | Example: |
257 | use AnyEvent; |
281 | use AnyEvent; |
258 | use BDB; |
282 | use BDB; |
259 | |
283 | |
… | |
… | |
343 | DESTROY (DBC_ornull *dbc) |
367 | DESTROY (DBC_ornull *dbc) |
344 | CODE: |
368 | CODE: |
345 | if (dbc) |
369 | if (dbc) |
346 | dbc->c_close (dbc); |
370 | dbc->c_close (dbc); |
347 | |
371 | |
348 | $int = $cursor->set_priority ($priority = PRIORITY_*) |
372 | $int = $cursor->set_priority ($priority = PRIORITY_*) (v4.6) |
349 | |
373 | |
350 | Example: |
374 | Example: |
351 | my $c = $db->cursor; |
375 | my $c = $db->cursor; |
352 | |
376 | |
353 | for (;;) { |
377 | for (;;) { |