iterators should now work; need to update the behaviour of the upper lever classes
This commit is contained in:
parent
8df42deeba
commit
141ef1292a
@ -1500,7 +1500,7 @@ class BPlusTree {
|
|||||||
* @param int $keylen maximum lenght of a key in bytes (unicode extended chars evaluate to two chars)
|
* @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) {
|
if (!is_null($keylen) && $keylen<=2) {
|
||||||
trigger_error("$keylen must be greater than 2", E_USER_ERROR);
|
trigger_error("$keylen must be greater than 2", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
@ -2508,7 +2508,7 @@ class SBPlusTree extends BPlusTree {
|
|||||||
function SBPlusTree($infile, $stringfile,
|
function SBPlusTree($infile, $stringfile,
|
||||||
$maxstring = 256,
|
$maxstring = 256,
|
||||||
$pos=null, $nodesize=null, $keylen=null) {
|
$pos=null, $nodesize=null, $keylen=null) {
|
||||||
parent::BPlusTree($infile, $maxstring, $pos, $nodesize, $keylen);
|
parent::BPlusTree($infile, $pos, $nodesize, $keylen);
|
||||||
$this->stringfile = $stringfile;
|
$this->stringfile = $stringfile;
|
||||||
$this->maxstring = $maxstring;
|
$this->maxstring = $maxstring;
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,17 @@
|
|||||||
trigger_error ("Can't find index '{$this->_cachefile}'", E_USER_ERROR);
|
trigger_error ("Can't find index '{$this->_cachefile}'", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_tree = new caching_SBPT(
|
$this->_tree =& new caching_SBPT(
|
||||||
fopen($this->_cachefile.'.dat', 'r'),
|
fopen($this->_cachefile.'.dat', 'rb'),
|
||||||
fopen(INDEX_DIR.'index.strings.dat', 'r'),
|
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
|
||||||
|
256,
|
||||||
$this->_offset,
|
$this->_offset,
|
||||||
$this->_chunksize,
|
$this->_chunksize,
|
||||||
$this->_keysize
|
$this->_keysize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->_tree->open();
|
||||||
|
|
||||||
|
|
||||||
#return $this->_list;
|
#return $this->_list;
|
||||||
|
|
||||||
|
@ -42,8 +42,9 @@
|
|||||||
$mode = 'w+b';
|
$mode = 'w+b';
|
||||||
|
|
||||||
$this->indices[0] = new SBPlusTree(
|
$this->indices[0] = new SBPlusTree(
|
||||||
fopen(INDEX_DIR.'index-0.dat', $mode),
|
fopen($f, $mode),
|
||||||
fopen(INDEX_DIR.'index.strings.dat', $mode),
|
fopen(INDEX_DIR.'index.strings.dat', $mode),
|
||||||
|
256,
|
||||||
$this->_offset,
|
$this->_offset,
|
||||||
$this->_chunksize,
|
$this->_chunksize,
|
||||||
$this->_keysize
|
$this->_keysize
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
var $counter = -1;
|
var $counter = -1;
|
||||||
var $params = null;
|
var $params = null;
|
||||||
var $single = false;
|
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 $processed = false;
|
||||||
var $ID = 0; /* query id */
|
var $ID = 0; /* query id */
|
||||||
|
|
||||||
@ -318,7 +318,6 @@
|
|||||||
|
|
||||||
#$id = $this->_fillCurrentId();
|
#$id = $this->_fillCurrentId();
|
||||||
|
|
||||||
|
|
||||||
while ($this->walker->valid && $this->pointer<$qp->start) {
|
while ($this->walker->valid && $this->pointer<$qp->start) {
|
||||||
|
|
||||||
$this->previd = $this->currentid;
|
$this->previd = $this->currentid;
|
||||||
@ -331,7 +330,7 @@
|
|||||||
// pointer == start
|
// pointer == start
|
||||||
|
|
||||||
$this->previd = $this->currentid;
|
$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) {
|
if ($qp->fullparse && $this->counter <= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user