At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
------------------------------------------------------------
revno: 186
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Fri 2007-10-19 03:01:28 -0700
message:
Fixed NdbResultSet to support calling next() on a non-scan operation. The new next will
return true the first time it is called on a non-scan and false all subsequent times.
Perhaps we should add a "reset" method to allow next to be called again?
modified:
java/com/mysql/cluster/ndbj/NdbResultSetImpl.java
ndbresultsetimpl.jav-20070517181935-98huwjarzuh25b30-22
java/testsuite/ndbj/MultiPartPrimaryKeyStringTest.java
multipartprimarykeys-20070517181935-98huwjarzuh25b30-49
=== modified file 'java/com/mysql/cluster/ndbj/NdbResultSetImpl.java'
--- a/java/com/mysql/cluster/ndbj/NdbResultSetImpl.java 2007-10-11 08:12:14 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbResultSetImpl.java 2007-10-19 10:01:28 +0000
@@ -27,6 +27,8 @@
private int lastColumnNull;
private boolean run = false;
+
+ private boolean fetched = false;
private boolean hasData;
@@ -209,9 +211,17 @@
public boolean next(boolean fetchAllowed) throws NdbApiException {
// TODO: Seriously - this method and the next need to be redesigned
+ if (NdbScanOperationImpl.class.isInstance((Object)op)) {
int scanCheck = ((NdbScanOperation)op).nextResult(fetchAllowed);
return (scanCheck==0);
+ } else {
+ if (fetched)
+ return false;
+ fetched=true;
+ return true;
+ }
+ // It's not a scan operation
}
/**
* @see com.mysql.cluster.ndbj.NdbResultSet#next()
=== modified file 'java/testsuite/ndbj/MultiPartPrimaryKeyStringTest.java'
--- a/java/testsuite/ndbj/MultiPartPrimaryKeyStringTest.java 2007-10-19 09:54:45 +0000
+++ b/java/testsuite/ndbj/MultiPartPrimaryKeyStringTest.java 2007-10-19 10:01:28 +0000
@@ -139,7 +139,7 @@
byte[] c=null;
int numRes=0;
- while(rs.next())
+ while(rs.next())
{
numRes++;
c = rs.getBytes(col3);
| Thread |
|---|
| • Rev 186: Fixed NdbResultSet to support calling next() on a non-scan operation. The new next will return true the first time it is called on a non-scan... | Monty Taylor | 19 Oct |