6 class QueryIterator<T> {
8 var nextValue : Maybe<T>;
9 public function new(result) {
11 /* We fetch the first row , so we can answer hasNext */
15 private function fetch() {
16 var next : Dynamic = untyped __call__('db_fetch', this.result);
17 nextValue = if(next) Just(next) else Nothing;
20 public function hasNext() : Bool {
21 return this.nextValue != Nothing;
24 public function next() : T {
25 switch(this.nextValue) {
26 case Nothing : throw 'Iterator exhausted';