List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:September 15 2007 12:50am
Subject:Rev 153: Added long-form readTuples() to Impl class and interface. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge

------------------------------------------------------------
revno: 153
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Fri 2007-09-14 17:50:17 -0700
message:
  Added long-form readTuples() to Impl class and interface. 
  Moved references to LockMode to use the generated enum. 
modified:
  java/com/mysql/cluster/ndbj/NdbBaseOperation.java
ndbbaseoperation.jav-20070517181935-98huwjarzuh25b30-5
  java/com/mysql/cluster/ndbj/NdbBaseOperationImpl.java
ndboperationimpl.jav-20070517181935-98huwjarzuh25b30-20
  java/com/mysql/cluster/ndbj/NdbIndexScanOperation.java
ndbindexscanoperatio-20070517181935-98huwjarzuh25b30-17
  java/com/mysql/cluster/ndbj/NdbIndexScanOperationImpl.java
ndbindexscanoperatio-20070517181935-98huwjarzuh25b30-18
  java/com/mysql/cluster/ndbj/NdbScanOperation.java
ndbscanoperation.jav-20070517181935-98huwjarzuh25b30-25
  java/com/mysql/cluster/ndbj/NdbScanOperationImpl.java
ndbscanoperationimpl-20070517181935-98huwjarzuh25b30-26
  java/testsuite/ndbj/OrderedIndexScanTest.java
orderedindexscantest-20070913200612-yxpzo7ji93xk863r-1
=== modified file 'java/com/mysql/cluster/ndbj/NdbBaseOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbBaseOperation.java	2007-09-14 08:06:22 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbBaseOperation.java	2007-09-15 00:50:17 +0000
@@ -1,6 +1,7 @@
 package com.mysql.cluster.ndbj;
 
 import java.sql.Timestamp;
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
 
 /**
  * The NdbBaseOperation interface defines get<> operations supported by
@@ -253,26 +254,6 @@
 
 
 	/**
-	 * The values of the LockMode enum should match those specified in the
-	 * native NDB-API in NdbOperationRef.h
-	 * NdbOperationRef.LockMode.LM_Read is a read with a shared lock
-	 * <p>NdbOperationRef.LockMode.LM_Exclusive is a read with an exclusive lock
-	 * <p>NdbOperationRef.LockMode.CommittedRead reads the last committed value
-	 * @see committedRead
-	 */
-	public enum LockMode {
-		LM_Read(0), ///< Read with shared lock
-		LM_Exclusive(1), ///< Read with exclusive lock
-		LM_CommittedRead(2); ///< Ignore locks, read last committed value
-
-		public int type = 0;
-
-		private LockMode(int type) {
-			this.type = type;
-		}
-	};
-
-	/**
 	 * Indicates that the primary key operation will read a row.
 	 * @param mode the type of lock to take on the row (read last committed value, or take
an exclusive lock)
      * @throws NdbApiException if there is a problem in the cluster.

=== modified file 'java/com/mysql/cluster/ndbj/NdbBaseOperationImpl.java'
--- a/java/com/mysql/cluster/ndbj/NdbBaseOperationImpl.java	2007-09-14 08:06:22 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbBaseOperationImpl.java	2007-09-15 00:50:17 +0000
@@ -12,6 +12,7 @@
 import java.sql.Timestamp;
 
 
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
  
 class NdbBaseOperationImpl extends NdbBaseImpl implements NdbBaseOperation {
 

=== modified file 'java/com/mysql/cluster/ndbj/NdbIndexScanOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbIndexScanOperation.java	2007-09-14 07:54:14 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbIndexScanOperation.java	2007-09-15 00:50:17 +0000
@@ -3,6 +3,9 @@
 import java.util.Calendar;
 
 
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
+
+
 /**
  * This interface describes operations that can be performed on an INDEX in a
  * table. <br>
@@ -104,6 +107,82 @@
 	public abstract void readTuples() 
 		throws NdbApiException;
 	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @param keyinfo
+	 * @param multi_range
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean, boolean, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, 
+			boolean order_by, boolean order_desc, boolean read_range_no, 
+			boolean keyinfo, boolean multi_range) 
+	throws NdbApiException;
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @param keyinfo
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean, boolean)
+	 */
+	public abstract int readTuples(LockMode lock_mode, long batch, long parallel, 
+			boolean order_by, boolean order_desc, boolean read_range_no, boolean keyinfo) 
+	throws NdbApiException;
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean)
+	 */
+	public abstract int readTuples(LockMode lock_mode, long batch, long parallel, boolean
order_by, 
+			boolean order_desc, boolean read_range_no) 
+	throws NdbApiException;
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean)
+	 */
+	public abstract int readTuples(LockMode lock_mode, long batch, long parallel, 
+			boolean order_by, boolean order_desc) 
+		throws NdbApiException;
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean)
+	 */
+	public abstract int readTuples(LockMode lock_mode, long batch, long parallel, boolean
order_by) 
+		throws NdbApiException;
+
+	
+	/**
 	TODO: Make this version of the method
 	 * An index scan operation to read many tuples.
 	 * 

=== modified file 'java/com/mysql/cluster/ndbj/NdbIndexScanOperationImpl.java'
--- a/java/com/mysql/cluster/ndbj/NdbIndexScanOperationImpl.java	2007-09-15 00:23:05 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbIndexScanOperationImpl.java	2007-09-15 00:50:17 +0000
@@ -4,6 +4,8 @@
 import java.sql.Timestamp;
 import java.util.Calendar;
 
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
+
 
 /**
  * This class implements the NdbScanOperationRef interface and provides the JNI
@@ -231,7 +233,7 @@
 	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, long)
 	 */
 	public void readTuples(LockMode lock_mode, long scan_flags, long parallel, long batch)
throws NdbApiException {
-		scanOpRef.readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(lock_mode.type),
scan_flags, parallel, batch);
+		scanOpRef.readTuples(lock_mode, scan_flags, parallel, batch);
 	}
 
 	/**
@@ -243,7 +245,7 @@
 	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long)
 	 */
 	public void readTuples(LockMode lock_mode, long scan_flags, long parallel) throws
NdbApiException {
-		scanOpRef.readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(lock_mode.type),
scan_flags, parallel);
+		scanOpRef.readTuples(lock_mode, scan_flags, parallel);
 	}
 
 	/**
@@ -254,7 +256,7 @@
 	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long)
 	 */
 	public void readTuples(LockMode lock_mode, long scan_flags) throws NdbApiException {
-		scanOpRef.readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(lock_mode.type),
scan_flags);
+		scanOpRef.readTuples(lock_mode, scan_flags);
 	}
 
 	/**
@@ -264,7 +266,82 @@
 	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode)
 	 */
 	public void readTuples(LockMode lock_mode) throws NdbApiException {
-		scanOpRef.readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(lock_mode.type));
+		scanOpRef.readTuples(lock_mode);
+	}
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @param keyinfo
+	 * @param multi_range
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean, boolean, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, boolean order_by,
boolean order_desc, boolean read_range_no, boolean keyinfo, boolean multi_range) throws
NdbApiException {
+		return scanOpRef.readTuples(lock_mode, batch, parallel, order_by, order_desc,
read_range_no, keyinfo, multi_range);
+	}
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @param keyinfo
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, boolean order_by,
boolean order_desc, boolean read_range_no, boolean keyinfo) throws NdbApiException {
+		return scanOpRef.readTuples(lock_mode, batch, parallel, order_by, order_desc,
read_range_no, keyinfo);
+	}
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @param read_range_no
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, boolean order_by,
boolean order_desc, boolean read_range_no) throws NdbApiException {
+		return scanOpRef.readTuples(lock_mode, batch, parallel, order_by, order_desc,
read_range_no);
+	}
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @param order_desc
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, boolean order_by,
boolean order_desc) throws NdbApiException {
+		return scanOpRef.readTuples(lock_mode, batch, parallel, order_by, order_desc);
+	}
+
+	/**
+	 * @param lock_mode
+	 * @param batch
+	 * @param parallel
+	 * @param order_by
+	 * @return
+	 * @throws NdbApiException
+	 * @see
com.mysql.cluster.ndbj.NdbIndexScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode,
long, long, boolean)
+	 */
+	public int readTuples(LockMode lock_mode, long batch, long parallel, boolean order_by)
throws NdbApiException {
+		return scanOpRef.readTuples(lock_mode, batch, parallel, order_by);
 	}
 
 	/**

=== modified file 'java/com/mysql/cluster/ndbj/NdbScanOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbScanOperation.java	2007-09-14 08:06:22 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbScanOperation.java	2007-09-15 00:50:17 +0000
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
 
 /**
  * The NdbBaseScan interface defines common methods providded by

=== modified file 'java/com/mysql/cluster/ndbj/NdbScanOperationImpl.java'
--- a/java/com/mysql/cluster/ndbj/NdbScanOperationImpl.java	2007-09-14 08:06:22 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbScanOperationImpl.java	2007-09-15 00:50:17 +0000
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 
+import com.mysql.cluster.ndbj.NdbOperationRef.LockMode;
 
 /**
  * NdbScanOperationRef class is used to perform table scans. Typically, table scan
@@ -51,7 +52,7 @@
     throws NdbApiException
     {
         scanOpRef.readTuples(
-        		com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(mode.type), 
+        		mode, 
         		(long)NdbScanOperation.ScanFlag.NO_FLAG.type, parallel, batch);
     }
     
@@ -60,9 +61,7 @@
             long parallel, long batch)
     throws NdbApiException
     {
-        scanOpRef.readTuples( 
-        		com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(mode.type), 
-        		(long)scanFlag.type, parallel, batch);
+        scanOpRef.readTuples(mode, (long)scanFlag.type, parallel, batch);
     }
 
 
@@ -74,9 +73,7 @@
 		for (ScanFlag sf : scanFlags) {
 			flags = flags | sf.type;
 		}
-		scanOpRef.readTuples(
-				com.mysql.cluster.ndbj.NdbOperationRef.LockMode.swigToEnum(mode.type),
-				(long)flags, parallel, batch);
+		scanOpRef.readTuples(mode, (long)flags, parallel, batch);
 	}
 
     /* (non-Javadoc)
@@ -275,7 +272,7 @@
 	 * @see
com.mysql.cluster.ndbj.NdbScanOperationRef#readTuples(com.mysql.cluster.ndbj.NdbOperationRef.LockMode)
 	 */
 	public void readTuples(LockMode lock_mode) throws NdbApiException {
-		scanOpRef.readTuples(NdbScanOperationRef.LockMode.swigToEnum(lock_mode.type));
+		scanOpRef.readTuples(lock_mode);
 	}
 
 

=== modified file 'java/testsuite/ndbj/OrderedIndexScanTest.java'
--- a/java/testsuite/ndbj/OrderedIndexScanTest.java	2007-09-14 09:30:02 +0000
+++ b/java/testsuite/ndbj/OrderedIndexScanTest.java	2007-09-15 00:50:17 +0000
@@ -10,6 +10,8 @@
 import com.mysql.cluster.ndbj.AbortOption;
 import com.mysql.cluster.ndbj.ExecType;
 
+import com.mysql.cluster.ndbj.NdbOperationRef;
+
 public class OrderedIndexScanTest extends BaseNdbjTestCase {
 
 	protected String col1="id";
@@ -56,21 +58,21 @@
 			
 			NdbIndexScanOperation iop=
 				trans.getNdbIndexScanOperation("PRIMARY", theTableName);
-			    
-			iop.readTuples(NdbOperation.LockMode.LM_CommittedRead);
+			
 			// We'll use this once we've implemented it
-			// iop.readTuples(NdbOperationRef.LockMode.LM_CommittedRead, 0,0,false,false,false
/*readRangeNo set to true to be able to read "many" ranges in one scan op*/);
+			iop.readTuples(NdbOperationRef.LockMode.LM_CommittedRead, 0,0,false,false,false
/*readRangeNo set to true to be able to read "many" ranges in one scan op*/);
 
 
 			/*   System.out.println("foo");
-			/*   
-			    iop.equal(0,1);
-			 */  
+			*/  
+			iop.equal(0,1);
+			
+			/*
 			assertEquals(NdbIndexScanOperation.BoundType.BoundEQ.type,4);
 			
 			iop.setBound(0, 
 					NdbIndexScanOperation.BoundType.BoundEQ,
-					1);
+					1);*/
 
 			long bound_no=0;
 			iop.endOfBound(bound_no);

Thread
Rev 153: Added long-form readTuples() to Impl class and interface. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor15 Sep