… | |
… | |
160 | In the following, C<$int> signifies an integer return value, |
160 | In the following, C<$int> signifies an integer return value, |
161 | C<bdb_filename> is a "filename" (octets on unix, madness on windows), |
161 | C<bdb_filename> is a "filename" (octets on unix, madness on windows), |
162 | C<U32> is an unsigned 32 bit integer, C<int> is some integer, C<NV> is a |
162 | C<U32> is an unsigned 32 bit integer, C<int> is some integer, C<NV> is a |
163 | floating point value. |
163 | floating point value. |
164 | |
164 | |
165 | The C<SV *> types are generic perl scalars (for input and output of data |
165 | Most C<SV *> types are generic perl scalars (for input and output of data |
166 | values), and the C<SV *callback> is the optional callback function to call |
166 | values). |
167 | when the request is completed. |
|
|
168 | |
167 | |
169 | The various C<DB_ENV> etc. arguments are handles return by |
168 | The various C<DB_ENV> etc. arguments are handles return by |
170 | C<db_env_create>, C<db_create>, C<txn_begin> and so on. If they have an |
169 | C<db_env_create>, C<db_create>, C<txn_begin> and so on. If they have an |
171 | appended C<_ornull> this means they are optional and you can pass C<undef> |
170 | appended C<_ornull> this means they are optional and you can pass C<undef> |
172 | for them, resulting a NULL pointer on the C level. |
171 | for them, resulting a NULL pointer on the C level. |
|
|
172 | |
|
|
173 | The C<SV *callback> is the optional callback function to call when the |
|
|
174 | request is completed. This last callback argument is special: the callback |
|
|
175 | is simply the last argument passed. If there are "optional" arguments |
|
|
176 | before the callback they can be left out. The callback itself can be left |
|
|
177 | out or specified as C<undef>, in which case the function will be executed |
|
|
178 | synchronously. |
|
|
179 | |
|
|
180 | For example, C<db_env_txn_checkpoint> usually is called with all integer |
|
|
181 | arguments zero. These can be left out, so all of these specify a call |
|
|
182 | to C<< DB_ENV->txn_checkpoint >>, to be executed asynchronously with a |
|
|
183 | callback to be called: |
|
|
184 | |
|
|
185 | db_env_txn_checkpoint $db_env, 0, 0, 0, sub { }; |
|
|
186 | db_env_txn_checkpoint $db_env, 0, 0, sub { }; |
|
|
187 | db_env_txn_checkpoint $db_env, sub { }; |
|
|
188 | |
|
|
189 | While these all specify a call to C<< DB_ENV->txn_checkpoint >> to be |
|
|
190 | executed synchronously: |
|
|
191 | |
|
|
192 | db_env_txn_checkpoint $db_env, 0, 0, 0, undef; |
|
|
193 | db_env_txn_checkpoint $db_env, 0, 0, 0; |
|
|
194 | db_env_txn_checkpoint $db_env, 0; |
173 | |
195 | |
174 | =head3 BDB functions |
196 | =head3 BDB functions |
175 | |
197 | |
176 | Functions in the BDB namespace, exported by default: |
198 | Functions in the BDB namespace, exported by default: |
177 | |
199 | |
… | |
… | |
546 | |
568 | |
547 | BerkeleyDB comes in various versions, many of them have minor |
569 | BerkeleyDB comes in various versions, many of them have minor |
548 | incompatibilities. This means that traditional "at least version x.x" |
570 | incompatibilities. This means that traditional "at least version x.x" |
549 | checks are often not sufficient. |
571 | checks are often not sufficient. |
550 | |
572 | |
|
|
573 | Example: set the log_autoremove option in a way compatible with <v.47 and |
|
|
574 | v4.7. Note the use of & on the constants to avoid triggering a compiletime |
|
|
575 | bug when the symbol isn't available. |
|
|
576 | |
|
|
577 | $DB_ENV->set_flags (&BDB::LOG_AUTOREMOVE ) if BDB::VERSION v0, v4.7; |
|
|
578 | $DB_ENV->log_set_config (&BDB::LOG_AUTO_REMOVE) if BDB::VERSION v4.7; |
|
|
579 | |
551 | =over 4 |
580 | =over 4 |
552 | |
581 | |
553 | =item BDB::VERSION |
582 | =item BDB::VERSION |
554 | |
583 | |
555 | The C<BDB::VERSION> function, when called without arguments, returns the |
584 | The C<BDB::VERSION> function, when called without arguments, returns the |