}
private function fetch() {
- var next = untyped __call__('db_fetch', this.result);
+ var next : Dynamic = untyped __call__('db_fetch', this.result);
this.nextValue = if(next) Just(next) else Nothing;
}
public function hasNext() : Bool {
- return this.next == Nothing;
+ return this.nextValue == Nothing;
}
public function next() : T {
switch(this.nextValue) {
case Nothing : throw 'Iterator exhausted';
- case Just(v) : return v;
+ case Just(v) : {
+ this.fetch();
+ return v;
+ };
}
}
}
class FA {
static public function query(sql: String) {
var result = untyped __call__('db_query', sql);
- return QueryIterator(result);
+ return new QueryIterator(result);
}
}
class ItemScheduler {