From: Maxime Bourget Date: Mon, 27 May 2013 18:16:37 +0000 (+0100) Subject: QueryIterator compiles. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=47d708ff21347d004a5d697715123a5cccfcae4d;p=order_line_extra.git QueryIterator compiles. --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index 2ce0fa0..cec9f27 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -15,25 +15,28 @@ class QueryIterator { } 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 {