diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-04-16 13:57:00 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2009-04-16 13:57:00 +0000 |
commit | cc3c2f72dfe906ed25ebea6ab71ca5d5454b8bbe (patch) | |
tree | 9939f7a88dac2f0a95c53990c6fb9df3913cd1b1 /src | |
parent | c8639e6f9cc5e3e2bb5dabdbf864660d72a7c684 (diff) | |
download | scala-cc3c2f72dfe906ed25ebea6ab71ca5d5454b8bbe.tar.gz scala-cc3c2f72dfe906ed25ebea6ab71ca5d5454b8bbe.tar.bz2 scala-cc3c2f72dfe906ed25ebea6ab71ca5d5454b8bbe.zip |
Fixed a bug that prevented DBC from working wit...
Fixed a bug that prevented DBC from working with Apache Derby.
Diffstat (limited to 'src')
-rw-r--r-- | src/dbc/scala/dbc/result/Relation.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dbc/scala/dbc/result/Relation.scala b/src/dbc/scala/dbc/result/Relation.scala index 610131abd8..67a8e51cc3 100644 --- a/src/dbc/scala/dbc/result/Relation.scala +++ b/src/dbc/scala/dbc/result/Relation.scala @@ -53,10 +53,11 @@ abstract class Relation extends AnyRef with Iterable[Tuple] { * iterators will share the same state. */ def elements: Iterator[Tuple] = new Iterator[Tuple] { protected val result: java.sql.ResultSet = Relation.this.sqlResult - def hasNext: Boolean = !(result.isLast()) + def hasNext: Boolean = resultNext + private var resultNext = result.next() def next: Tuple = { - if (result.next()) { - new Tuple { + if (resultNext) { + val newTuple = new Tuple { val me = this val originatingRelation = Relation.this val fields: List[Field] = for (fieldMetadata <- metadata) yield @@ -66,7 +67,10 @@ abstract class Relation extends AnyRef with Iterable[Tuple] { val originatingTuple = me } } - } else error("next on empty iterator") + resultNext = result.next() + newTuple + } + else error("next on empty iterator") } } } |