root/lang/php/misc/Hermit/src/Queue/HermitQueueIterator.php @ 26931

Revision 26931, 1.1 kB (checked in by nowelium, 4 years ago)

* Q4M 側をselect ... where queue_wait(table) で multi rows に変更
* owner 以外で abort しちゃうので、complete 時のみ abort にすることに
* rollback で "There is no active transaction" が出てた。rollback後もbegin=falseにするように変更
** 例外を追加

Line 
1<?php
2
3/**
4 * @author nowelium
5 */
6class HermitQueueIterator implements HermitQueue, Iterator {
7    protected $hermit;
8    protected $table;
9    protected $timeout = 0;
10    protected $index = 0;
11    public function __construct(Hermit $hermit){
12        $this->hermit = $hermit;
13    }
14    public function setTable($table){
15        $this->table = $table;
16    }
17    public function setTimeout($timeout){
18        $this->timeout = $timeout;
19    }
20    public function fetch(){
21        return $this->hermit->get($this->table);
22    }
23    public function wait(){
24        return $this->hermit->wait($this->table, $this->timeout);
25    }
26    public function end(){
27        return $this->hermit->end($this->table);
28    }
29    public function abort(){
30        return $this->hermit->abort();
31    }
32    public function rewind(){
33        $this->index = 0;
34    }
35    public function key(){
36        return $this->index;
37    }
38    public function current(){
39        $row = $this->wait();
40        return $row[0];
41    }
42    public function next(){
43        return $this->index++;
44    }
45    public function valid(){
46        //
47        // while true
48        //
49        return true;
50    }
51}
Note: See TracBrowser for help on using the browser.