ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/BDB.pm
(Generate patch)

Comparing BDB/BDB.pm (file contents):
Revision 1.11 by root, Mon Aug 13 12:04:41 2007 UTC vs.
Revision 1.12 by root, Mon Aug 13 12:07:46 2007 UTC

7 use BDB; 7 use BDB;
8 8
9=head1 DESCRIPTION 9=head1 DESCRIPTION
10 10
11See the BerkeleyDB documentation (L<http://www.oracle.com/technology/documentation/berkeley-db/db/index.html>). 11See the BerkeleyDB documentation (L<http://www.oracle.com/technology/documentation/berkeley-db/db/index.html>).
12The BDB API is very similar to the C API (the translation ahs been very faithful). 12The BDB API is very similar to the C API (the translation has been very faithful).
13 13
14See also the example sections in the document below and possibly the eg/ 14See also the example sections in the document below and possibly the eg/
15subdirectory of the BDB distribution. Last not least see the IO::AIO 15subdirectory of the BDB distribution. Last not least see the IO::AIO
16documentation, as that module uses almost the same asynchronous request 16documentation, as that module uses almost the same asynchronous request
17model as this module. 17model as this module.
138 138
139 $db = db_create (DB_ENV *env = 0, U32 flags = 0) 139 $db = db_create (DB_ENV *env = 0, U32 flags = 0)
140 140
141 db_open (DB *db, DB_TXN_ornull *txnid, octetstring file, octetstring database, int type, U32 flags, int mode, SV *callback = &PL_sv_undef) 141 db_open (DB *db, DB_TXN_ornull *txnid, octetstring file, octetstring database, int type, U32 flags, int mode, SV *callback = &PL_sv_undef)
142 db_close (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef) 142 db_close (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef)
143 db_compact (DB *db, DB_TXN_ornull *txn = 0, SV *start = 0, SV *stop = 0, SV *unused1 = 0, U32 flags = DB_FREE_SPACE, SV *unused2 = 0, SV *callback = &PL_sv_unde 143 db_compact (DB *db, DB_TXN_ornull *txn = 0, SV *start = 0, SV *stop = 0, SV *unused1 = 0, U32 flags = DB_FREE_SPACE, SV *unused2 = 0, SV *callback = &PL_sv_undef)
144 db_sync (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef) 144 db_sync (DB *db, U32 flags = 0, SV *callback = &PL_sv_undef)
145 db_key_range (DB *db, DB_TXN_ornull *txn, SV *key, SV *key_range, U32 flags = 0, SV *callback = &PL_sv_undef) 145 db_key_range (DB *db, DB_TXN_ornull *txn, SV *key, SV *key_range, U32 flags = 0, SV *callback = &PL_sv_undef)
146 db_put (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) 146 db_put (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef)
147 db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) 147 db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef)
148 db_pget (DB *db, DB_TXN_ornull *txn, SV *key, SV *pkey, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef) 148 db_pget (DB *db, DB_TXN_ornull *txn, SV *key, SV *pkey, SV *data, U32 flags = 0, SV *callback = &PL_sv_undef)
192 $int = $env->set_lg_bsize (U32 max) 192 $int = $env->set_lg_bsize (U32 max)
193 $int = $env->set_lg_max (U32 max) 193 $int = $env->set_lg_max (U32 max)
194 194
195 $txn = $env->txn_begin (DB_TXN_ornull *parent = 0, U32 flags = 0) 195 $txn = $env->txn_begin (DB_TXN_ornull *parent = 0, U32 flags = 0)
196 196
197=head4 example 197=head4 Example:
198 198
199 use AnyEvent; 199 use AnyEvent;
200 use BDB; 200 use BDB;
201 201
202 our $FH; open $FH, "<&=" . BDB::poll_fileno; 202 our $FH; open $FH, "<&=" . BDB::poll_fileno;
243 $int = $db->set_q_extentsize (U32 extentsize) 243 $int = $db->set_q_extentsize (U32 extentsize)
244 244
245 $dbc = $db->cursor (DB_TXN_ornull *txn = 0, U32 flags = 0) 245 $dbc = $db->cursor (DB_TXN_ornull *txn = 0, U32 flags = 0)
246 $seq = $db->sequence (U32 flags = 0) 246 $seq = $db->sequence (U32 flags = 0)
247 247
248=head4 example 248=head4 Example:
249 249
250 my $db = db_create $env; 250 my $db = db_create $env;
251 db_open $db, undef, "table", undef, BDB::BTREE, BDB::AUTO_COMMIT | BDB::CREATE | BDB::READ_UNCOMMITTED, 0600; 251 db_open $db, undef, "table", undef, BDB::BTREE, BDB::AUTO_COMMIT | BDB::CREATE | BDB::READ_UNCOMMITTED, 0600;
252 252
253 for (1..1000) { 253 for (1..1000) {
281 DESTROY (DBC_ornull *dbc) 281 DESTROY (DBC_ornull *dbc)
282 CODE: 282 CODE:
283 if (dbc) 283 if (dbc)
284 dbc->c_close (dbc); 284 dbc->c_close (dbc);
285 285
286=head4 example 286=head4 Example:
287 287
288 my $c = $db->cursor; 288 my $c = $db->cursor;
289 289
290 for (;;) { 290 for (;;) {
291 db_c_get $c, my $key, my $data, BDB::NEXT; 291 db_c_get $c, my $key, my $data, BDB::NEXT;
293 last if $!; 293 last if $!;
294 } 294 }
295 295
296 db_c_close $c; 296 db_c_close $c;
297 297
298
298=head3 DB_SEQUENCE/sequence methods 299=head3 DB_SEQUENCE/sequence methods
299 300
300Methods available on DB_SEQUENCE/$seq handles: 301Methods available on DB_SEQUENCE/$seq handles:
301 302
302 DESTROY (DB_SEQUENCE_ornull *seq) 303 DESTROY (DB_SEQUENCE_ornull *seq)
307 $int = $seq->initial_value (db_seq_t value) 308 $int = $seq->initial_value (db_seq_t value)
308 $int = $seq->set_cachesize (U32 size) 309 $int = $seq->set_cachesize (U32 size)
309 $int = $seq->set_flags (U32 flags) 310 $int = $seq->set_flags (U32 flags)
310 $int = $seq->set_range (db_seq_t min, db_seq_t max) 311 $int = $seq->set_range (db_seq_t min, db_seq_t max)
311 312
312=head4 example 313=head4 Example:
313 314
314 my $seq = $db->sequence; 315 my $seq = $db->sequence;
315 316
316 db_sequence_open $seq, undef, "seq", BDB::CREATE; 317 db_sequence_open $seq, undef, "seq", BDB::CREATE;
317 db_sequence_get $seq, undef, 1, my $value; 318 db_sequence_get $seq, undef, 1, my $value;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines