|
|||||||||||
|
Rev 163: Finshed the major part of *ref/*impl merge. Basic tests pass now. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
From: Monty Taylor <mtaylor(at)mysql.com>
Date: Sun Sep 30 2007 - 17:24:19 EDT
revno: 163 revision-id: mtaylor@mysql.com-20070930212146-qn2s2dpzsogmnmnm parent: mtaylor@mysql.com-20070930023945-xs3411hjls3zhvs6 committer: Monty Taylor <mtaylor@mysql.com> branch nick: ndbjmerge timestamp: Sun 2007-09-30 14:21:46 -0700 message: Finshed the major part of *ref/*impl merge. Basic tests pass now. Implemented equal methods as compat-upgrade layer. Actually instantiate the resultSet HashMap. modified: java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java ndbbaseoperationequa-20070517181935-98huwjarzuh25b30-6 java/com/mysql/cluster/ndbj/NdbScanOperation.java ndbscanoperation.jav-20070517181935-98huwjarzuh25b30-25 java/com/mysql/cluster/ndbj/NdbScanOperationImpl.java ndbscanoperationimpl-20070517181935-98huwjarzuh25b30-26 java/com/mysql/cluster/ndbj/NdbTransaction.java ndbtransaction.java-20070517181935-98huwjarzuh25b30-27 java/com/mysql/cluster/ndbj/examples/JoinUsingScanAndIndexScan.java joinusingscanandinde-20070517181935-98huwjarzuh25b30-37 java/ndbj.i ndbj.i-20070913223244-5938mztpztyn9sry-1 java/testsuite/ndbj/NdbIndexScanOperationUtf8Latin1Test.java ndbindexscanoperatio-20070517181935-98huwjarzuh25b30-51 java/testsuite/ndbj/NdbOperationIDTest.java ndboperationidtest.j-20070517181935-98huwjarzuh25b30-53 java/testsuite/ndbj/NdbOperationTest.java ndboperationtest.jav-20070517181935-98huwjarzuh25b30-55 java/testsuite/ndbj/NdbOperationsFailedTest.java ndboperationsfailedt-20070517181935-98huwjarzuh25b30-56 swig/NdbScanOperation.i ndbscanoperation.i-20070228021421-qkr4cbpxymyqdrf3-5 swig/NdbTransaction.i ndbtransaction.i-20070227184716-ecjyhh3jgvmye4de-7 === modified file 'java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java' --- a/java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java 2007-09-30 02:39:45 +0000 +++ b/java/com/mysql/cluster/ndbj/NdbBaseOperationEquals.java 2007-09-30 21:21:46 +0000- - + @Deprecated + public int equal(long columnId, Timestamp val) throws NdbApiException; /** * * @param columnName name of the Column in the Schema - public abstract int readTuples(LockMode mode, long scanFlag, long parallel, + public abstract int readTuples(LockMode mode, ScanFlag scanFlag, long parallel, long batch) throws NdbApiException;
public int readTuples(NdbOperation.LockMode lock_mode) throws NdbApiException {
return (cPtr == 0) ? null : new NdbScanFilterRef(cPtr, false); }
+ public enum ScanFlag {
+ SF_TupScan(ndbjJNI.NdbScanOperationImpl_SF_TupScan_get()),
+ SF_DiskScan(ndbjJNI.NdbScanOperationImpl_SF_DiskScan_get()),
+ SF_OrderBy(ndbjJNI.NdbScanOperationImpl_SF_OrderBy_get()),
+ SF_Descending(ndbjJNI.NdbScanOperationImpl_SF_Descending_get()),
+ SF_ReadRangeNo(ndbjJNI.NdbScanOperationImpl_SF_ReadRangeNo_get()),
+ SF_MultiRange(ndbjJNI.NdbScanOperationImpl_SF_MultiRange_get()),
+ SF_KeyInfo(ndbjJNI.NdbScanOperationImpl_SF_KeyInfo_get());
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public static ScanFlag swigToEnum(int swigValue) {
+ ScanFlag[] swigValues = ScanFlag.class.getEnumConstants();
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (ScanFlag swigEnum : swigValues)
+ if (swigEnum.swigValue == swigValue)
+ return swigEnum;
+ throw new IllegalArgumentException("No enum " + ScanFlag.class + " with value " + swigValue);
+ }
+
+ private ScanFlag() {
+ this.swigValue = SwigNext.next++;
+ }
+
+ private ScanFlag(int swigValue) {
+ this.swigValue = swigValue;
+ SwigNext.next = swigValue+1;
+ }
+
+ private ScanFlag(ScanFlag swigEnum) {
+ this.swigValue = swigEnum.swigValue;
+ SwigNext.next = this.swigValue+1;
+ }
+
+ private final int swigValue;
+
+ private static class SwigNext {
+ private static int next = 0;
+ }
+ }
+
}
/**
public NdbIndexScanOperation getNdbIndexScanOperation( NdbIndex theIndex) throws NdbApiException; === modified file 'java/com/mysql/cluster/ndbj/examples/JoinUsingScanAndIndexScan.java' --- a/java/com/mysql/cluster/ndbj/examples/JoinUsingScanAndIndexScan.java 2007-09-17 01:09:47 +0000 +++ b/java/com/mysql/cluster/ndbj/examples/JoinUsingScanAndIndexScan.java 2007-09-30 21:21:46 +0000 @@ -9,7 +9,6 @@ import com.mysql.cluster.ndbj.NdbFactory; import com.mysql.cluster.ndbj.NdbIndexScanOperation; import com.mysql.cluster.ndbj.NdbOperation; -import com.mysql.cluster.ndbj.NdbOperationRef; import com.mysql.cluster.ndbj.NdbResultSet; import com.mysql.cluster.ndbj.NdbScanOperation; import com.mysql.cluster.ndbj.NdbTransaction; @@ -214,7 +213,8 @@ NdbScanOperation op_a = trans.getNdbScanOperation("ndbj_join_a");
%{
typedef struct
-//%typemap(jstype) Ndb_cluster_connection * "NdbClusterConnection" -//%typemap(javain) Ndb_cluster_connection * "NdbClusterConnectionImpl.getCPtr((NdbClusterConnectionImpl)$javainput)" %typemap(javainterfaces) Ndb_cluster_connection "NdbClusterConnection"; %include "NdbClusterConnection.i"
+/*
+%rename(realStartTransaction) Ndb::startTransaction;
+%javamethodmodifiers Ndb::startTransaction "protected"
+%typemap(javacode) Ndb %{
+
+ public NdbTransactionImpl startTransaction(NdbTable table, String keyData, long keyLen) throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction(table,keyData,keyLen);
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+
+ public NdbTransactionImpl startTransaction(NdbTable table, String keyData) throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction(table,keyData);
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+
+ public NdbTransactionImpl startTransaction(NdbTable table) throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction(table);
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+
+ public NdbTransactionImpl startTransaction() throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction();
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+ public NdbTransactionImpl startTransaction(String aTableName, int keyData) throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction(aTableName,keyData);
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+ public NdbTransactionImpl startTransaction(String aTableName, String keyData) throws NdbApiException {
+ NdbTransactionImpl theTrans = realStartTransaction(aTableName,keyData);
+ theTrans.theNdb = this;
+ return theTrans;
+ }
+
+ %}
+*/
%include "Ndb.i" %include "NdbDictionary.i"
+/*
+%javamethodmodifiers NdbTransaction::getNdbIndexOperation(Ndb*, const char*, const char*) "protected";
+%javamethodmodifiers NdbTransaction::getNdbIndexScanOperation(Ndb*, const char*, const char*) "protected";
+%rename(realGetNdbIndexOperation) getNdbIndexOperation(Ndb*, const char*, const char*);
+%rename(realGetNdbIndexScanOperation) getNdbIndexScanOperation(Ndb*, const char*, const char*);
+
+%typemap(javacode) NdbTransaction %{
+ protected NdbImpl theNdb;
+
+ public NdbIndexOperation getNdbIndexOperation(String indexName, String tableName) throws NdbApiException {
+ return realGetNdbIndexOperation(theNdb,indexName,tableName);
+ }
+ public NdbIndexScanOperation getNdbIndexScanOperation(String indexName, String tableName) throws NdbApiException {
+ return realGetNdbIndexScanOperation(theNdb,indexName,tableName);
+ }
+ %}
+*/
+
%include "NdbTransaction.i"
%extend NdbTransaction {
%typemap(javainterfaces) NdbOperation "NdbOperation,NdbInterpretedOperation";
%typemap(javabase) NdbOperation "NdbOperationResultsImpl";
+%typemap(javacode) NdbOperation %{
+
+public int equal(long columnId, BigInteger val) throws NdbApiException {
+ return equalUlong(columnId,val);
+}
+
+public int equal(long columnId, byte[] val) throws NdbApiException {
+ return equalBytes(columnId,val);
+}
+
+public int equal(long columnId, Calendar val) throws NdbApiException {
+ return equalDatetime(columnId,val);
+}
+
+public int equal(long columnId, int val) throws NdbApiException {
+ return equalInt(columnId,val);
+}
+
+public int equal(long columnId, long val) throws NdbApiException {
+ return equalLong(columnId,val);
+}
+
+public int equal(long columnId, String val) throws NdbApiException {
+ return equalString(columnId,val);
+}
+
+public int equal(long columnId, Timestamp val) throws NdbApiException {
+ return equalTimestamp(columnId,val);
+}
+
+public int equal(String columnName, BigInteger val) throws NdbApiException {
+ return equalUlong(columnName,val);
+}
+
+public int equal(String columnName, byte[] val) throws NdbApiException {
+ return equalBytes(columnName,val);
+}
+
+public int equal(String columnName, Calendar val) throws NdbApiException {
+ return equalDatetime(columnName,val);
+}
+
+public int equal(String columnName, int val) throws NdbApiException {
+ return equalInt(columnName,val);
+}
+
+public int equal(String columnName, long val) throws NdbApiException {
+ return equalLong(columnName,val);
+}
+
+public int equal(String columnName, String val) throws NdbApiException {
+ return equalString(columnName,val);
+}
+
+public int equal(String columnName, Timestamp val) throws NdbApiException {
+ return equalTimestamp(columnName,val);
+}
+ %}
+
+%typemap(javaimports) NdbOperation %{
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.math.BigInteger; + %}
%javamethodmodifiers NdbScanOperation::getNdbScanFilter "protected";
%rename(realGetNdbScanFilter) getNdbScanFilter();
%include "NdbOperation.i"
+
+%typemap(jstype) NdbScanOperation::ScanFlag "NdbScanOperation.ScanFlag"
+%typemap(javaout) NdbScanOperation::ScanFlag {
+ return NdbScanOperation.ScanFlag.swigToEnum(ndbjJNI.NdbScanOperationImpl_getScanFlag(swigCPtr, this));
+}
+
%include "NdbScanOperation.i" %include "NdbIndexOperation.i" @@ -394,12 +518,10 @@ %include "NdbEventOperation.i"
%include "NdbRecAttr.i"
%typemap(jstype) NdbBlob::State "NdbBlob.State"
op.readTuples(NdbOperation.LockMode.LM_Exclusive,0,0);
NdbResultSet rs = op.resultData();
op.setBytes(col11, binary_val);
System.out.println("Going to execute Insert: ("+int_val+", "+varcharlong_val + ", " + float_val + ", " + double_val + ", " + long_val + ")"); @@ -287,7 +287,7 @@
op.setBytes(col11, binary_val);
short_val+=3;
- op.setShort(col12, short_val);
+ op.setInt(col12, short_val);
trans.execute(ExecType.Commit,
AbortOption.AbortOnError,
=== modified file 'java/testsuite/ndbj/NdbOperationTest.java'
--- a/java/testsuite/ndbj/NdbOperationTest.java 2007-09-17 01:09:47 +0000
+++ b/java/testsuite/ndbj/NdbOperationTest.java 2007-09-30 21:21:46 +0000
@@ -117,7 +117,7 @@ op.setBytes(col11, binary_val);
System.out.println("Going to execute Insert: ("+int_val+", "+varcharlong_val + ", " + float_val + ", " + double_val + ", " + long_val + ")"); @@ -271,7 +271,7 @@
op.setBytes(col11, binary_val);
short_val+=3;
- op.setShort(col12, short_val);
+ op.setInt(col12, short_val);
trans.execute(ExecType.Commit,
AbortOption.AbortOnError,
=== modified file 'java/testsuite/ndbj/NdbOperationsFailedTest.java'
--- a/java/testsuite/ndbj/NdbOperationsFailedTest.java 2007-09-17 01:09:47 +0000
+++ b/java/testsuite/ndbj/NdbOperationsFailedTest.java 2007-09-30 21:21:46 +0000
@@ -27,6 +27,16 @@ public:
+ enum ScanFlag {
+ SF_TupScan = (1 << 16), // scan TUP order
+ SF_DiskScan = (2 << 16), // scan in DISK order
+ SF_OrderBy = (1 << 24), // index scan in order
+ SF_Descending = (2 << 24), // index scan in descending order
+ SF_ReadRangeNo = (4 << 24), // enable @ref get_range_no
+ SF_MultiRange = (8 << 24), // scan is part of multi-range scan
+ SF_KeyInfo = 1 // request KeyInfo to be sent back
+ };
+
%ndbexception("NdbApiException") {
$action
if (result==-1) {
@@ -36,7 +46,7 @@ } virtual int readTuples(LockMode lock_mode = LM_Read, - Uint32 scan_flags = 0, Uint32 parallel = 0, Uint32 batch = 0); + ScanFlag scan_flags = 0, Uint32 parallel = 0, Uint32 batch = 0);
int nextResult(bool fetchAllowed = true, bool forceSend = false);
int deleteCurrentTuple();
- + /* These first two are deprecated */ + NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName, + const char* aTableName); + NdbIndexScanOperation* getNdbIndexScanOperation + (const NdbDictionary::Index *anIndex, const NdbDictTable *aTable); NdbIndexScanOperation* getNdbIndexScanOperation(const NdbDictIndex *anIndex); + + NdbIndexOperation* getNdbIndexOperation(const char* anIndexName, + const char* aTableName); + NdbIndexOperation* getNdbIndexOperation(const NdbDictIndex *anIndex, + const NdbDictTable *aTable);
NdbIndexOperation* getNdbIndexOperation(const NdbDictIndex *anIndex);
-
NdbScanOperation* getNdbScanOperation(const class NdbDictTable* aTable);
NdbScanOperation* getNdbScanOperation(const char* aTableName);
NdbOperation* getNdbErrorOperation();
}
-
NdbIndexScanOperation* getNdbIndexScanOperation(Ndb* myNdb,
const char* anIndexName,
const char* aTableName)
- +*/
%ndbnoexception
void executeAsynchPrepare(ExecType execType,
BaseCallback * cb,
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Sun Sep 30 17:24:32 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:45:54 EDT |
||||||||||
|
|||||||||||