iterators should now work; need to update the behaviour of the upper lever classes

This commit is contained in:
real_nowhereman 2008-09-07 15:19:13 +00:00
parent 8df42deeba
commit 141ef1292a
4 changed files with 12 additions and 9 deletions

View File

@ -1500,7 +1500,7 @@ class BPlusTree {
* @param int $keylen maximum lenght of a key in bytes (unicode extended chars evaluate to two chars)
*/
function BplusTree($infile, $pos=null, $nodesize=null, $keylen=10) {
function BPlusTree($infile, $pos=null, $nodesize=null, $keylen=10) {
if (!is_null($keylen) && $keylen<=2) {
trigger_error("$keylen must be greater than 2", E_USER_ERROR);
}
@ -2508,7 +2508,7 @@ class SBPlusTree extends BPlusTree {
function SBPlusTree($infile, $stringfile,
$maxstring = 256,
$pos=null, $nodesize=null, $keylen=null) {
parent::BPlusTree($infile, $maxstring, $pos, $nodesize, $keylen);
parent::BPlusTree($infile, $pos, $nodesize, $keylen);
$this->stringfile = $stringfile;
$this->maxstring = $maxstring;
}

View File

@ -21,13 +21,16 @@
trigger_error ("Can't find index '{$this->_cachefile}'", E_USER_ERROR);
}
$this->_tree = new caching_SBPT(
fopen($this->_cachefile.'.dat', 'r'),
fopen(INDEX_DIR.'index.strings.dat', 'r'),
$this->_tree =& new caching_SBPT(
fopen($this->_cachefile.'.dat', 'rb'),
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
256,
$this->_offset,
$this->_chunksize,
$this->_keysize
);
$this->_tree->open();
#return $this->_list;

View File

@ -42,8 +42,9 @@
$mode = 'w+b';
$this->indices[0] = new SBPlusTree(
fopen(INDEX_DIR.'index-0.dat', $mode),
fopen($f, $mode),
fopen(INDEX_DIR.'index.strings.dat', $mode),
256,
$this->_offset,
$this->_chunksize,
$this->_keysize

View File

@ -120,7 +120,7 @@
var $counter = -1;
var $params = null;
var $single = false;
var $pointer = 1; /* pointer points always to NEXT element */
var $pointer = 0; /* pointer points always to NEXT element */
var $processed = false;
var $ID = 0; /* query id */
@ -318,7 +318,6 @@
#$id = $this->_fillCurrentId();
while ($this->walker->valid && $this->pointer<$qp->start) {
$this->previd = $this->currentid;
@ -331,7 +330,7 @@
// pointer == start
$this->previd = $this->currentid;
$id = $this->currentid = $this->walker->current_key();
$id = $this->currentid = entry_keytoid($this->walker->current_key());
if ($qp->fullparse && $this->counter <= 0) {