刚写完前面的日志,又发现一个Bug:
根据Oracle官方提供的说明:
http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/ext_php.html
class Db4的声明如下:
class Db4 {
function Db4($dbenv = null) {}// create a new Db4 object using
// the optional DbEnv
function open($txn = null, $file = null, $database = null,
$flags = DB_CREATE, $mode = 0) {}
function close() {}
function del($key, $txn = null) {}
function get($key, $txn = null, $flags = 0) {}
function pget($key, &$pkey, $txn = null, $flags = 0) {}
function get_type() {}// returns the stringified database type name
function stat($txn = null, $flags = 0) {} // returns statistics as
// an as
function join($cursor_list, $flags = 0) {}
function sync() {}
function truncate($txn = null, $flags = 0) {}
function cursor($txn = null, flags = 0) {}
}
想测试一下BTREE和HASH方式的性能区别的时候,却怎么也找不到指定数据表类型的参数。有是看php扩展的源代码,居然发现程序是支持的,open的原型应该如下:
function open($txn = null, $file = null, $database = null, $type = DB_BTREE, $flags = DB_CREATE, $mode = 0)
漏的还不是最后一个参数。真够faint的。另外php源码中也没有为DB_BTREE、DB_HASH等类型定义宏。又要自己动手丰衣足食了。
在db4.cpp中增加了声明:
REGISTER_LONG_CONSTANT("DB_BTREE", DB_BTREE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DB_HASH", DB_HASH, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DB_RECNO", DB_RECNO, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DB_QUEUE", DB_QUEUE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DB_UNKNOWN", DB_UNKNOWN, CONST_CS | CONST_PERSISTENT);
另外未在代码中找到设置Cache以及PageSize的函数。看来这个是真的不支持了。