From 141ef1292a5fb435550a0616ac11f01d7cbe0737 Mon Sep 17 00:00:00 2001 From: real_nowhereman Date: Sun, 7 Sep 2008 15:19:13 +0000 Subject: [PATCH] iterators should now work; need to update the behaviour of the upper lever classes --- fp-includes/core/core.bplustree.class.php | 4 ++-- fp-includes/core/core.cache.php | 9 ++++++--- fp-includes/core/core.entry.php | 3 ++- fp-includes/core/core.fpdb.class.php | 5 ++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/fp-includes/core/core.bplustree.class.php b/fp-includes/core/core.bplustree.class.php index 7064c11..a11f16c 100755 --- a/fp-includes/core/core.bplustree.class.php +++ b/fp-includes/core/core.bplustree.class.php @@ -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; } diff --git a/fp-includes/core/core.cache.php b/fp-includes/core/core.cache.php index 12ac667..a9da5c3 100755 --- a/fp-includes/core/core.cache.php +++ b/fp-includes/core/core.cache.php @@ -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; diff --git a/fp-includes/core/core.entry.php b/fp-includes/core/core.entry.php index a5adfe7..ffaefb3 100755 --- a/fp-includes/core/core.entry.php +++ b/fp-includes/core/core.entry.php @@ -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 diff --git a/fp-includes/core/core.fpdb.class.php b/fp-includes/core/core.fpdb.class.php index 165b5ab..c9dc3ce 100644 --- a/fp-includes/core/core.fpdb.class.php +++ b/fp-includes/core/core.fpdb.class.php @@ -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) {