1This is a PHP 4 wrapper for DB-4.2. It can either either link 2directly against libdb-4.2, which is necessary for running in 3a non Apache/mod_php4 environemnt), or against mod_db4, 4which provides additional safeties when running under Apache/mod_php4. 5 6*** A note about pthreads *** 7The db4 c++ library by default tries to link against libpthread on some 8systems (notably Linux). If your PHP install is not linked against 9libpthread, you will need to disable pthread support in db4. This can 10be done by compiling db4 with the flag --with-mutex=x86/gcc-assembly. 11PHP can itself be forced to link against libpthread either by manually 12editing its build files (which some distributions do), or by building it with 13--with-experimental-zts. 14 15 16This extension provides the following classes, which mirror the standard 17db4 C++ API. 18 19class Db4Env { 20 function Db4Env($flags = 0) {} 21 function close($flags = 0) {} // force a close 22 function dbremove($txn, $filename, $database = null, $flags = 0) {} 23 function dbrename($txn, $file, $database, $new_database, $flags = 0) {} 24 function open($home, 25 $flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN, 26 $mode = 0666) {} 27 function remove($home, $flags = 0) {} 28 function set_data_dir($directory) {} 29 function txn_begin($parent_txn = null, $flags = 0) {} 30 function txn_checkpoint($kbytes, $minutes, $flags = 0) {} 31} 32 33class Db4 { 34 function Db4($dbenv = null) {} // create a new Db4 object using the optional DbEnv 35 function open($txn = null, $file = null, $database = null, $flags = DB_CREATE, $mode = 0) {} 36 function close() {} // force a close 37 function del($key, $txn = null) {} 38 function get($key, $txn = null, $flags = 0) {} 39 function pget($key, &$pkey, $txn = null, $flags = 0) {} 40 function get_type() {} // returns the stringified database type name 41 function stat($txn = null, $flags = 0) {} // returns statistics as an associative array 42 function join($cursor_list, $flags = 0) {} 43 function sync() {} 44 function truncate($txn = null, $flags = 0) {} 45 function cursor($txn = null, flags = 0) {} 46} 47 48class Db4Txn { 49 function abort() {} 50 function commit() {} 51 function discard() P{ 52 function id() {} 53 function set_timeout($timeout, $flags = 0) {} 54} 55 56class Db4Cursor { 57 function close() {} 58 function count() {} 59 function del() {} 60 function dup($flags = 0) {} 61 function get($key, $flags = 0) {} 62 function pget($key, &$primary_key, $flags = 0) {} 63 function put($key, $data, $flags = 0) {} 64} 65 66The db4 extension attempts to be 'smart' for you by: 67o Automatically making operations auto-commit, when they 68must be transactional to even possibly succeed and you 69neglect a Db4Txn object. 70o Performing reference and dependency checking to insure 71that all resources are closed in the correct order. 72o Attempting intelligent default values for flags. 73