At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
------------------------------------------------------------
revno: 222
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Tue 2007-10-30 10:46:02 +0000
message:
commiting b0rked change so I can shelve it.
modified:
java/com/mysql/cluster/ndbj/NdbOperation.java
ndboperation.java-20070517181935-98huwjarzuh25b30-19
java/com/mysql/cluster/ndbj/NdbTransaction.java
ndbtransaction.java-20070517181935-98huwjarzuh25b30-27
java/ndbj.i ndbj.i-20070913223244-5938mztpztyn9sry-1
swig/NdbOperation.i ndboperation.i-20070228021421-qkr4cbpxymyqdrf3-3
swig/NdbTransaction.i ndbtransaction.i-20070227184716-ecjyhh3jgvmye4de-7
swig/ndbglobals.i globals.i-20070228021421-qkr4cbpxymyqdrf3-7
=== modified file 'java/com/mysql/cluster/ndbj/NdbOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbOperation.java 2007-10-23 01:41:19 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbOperation.java 2007-10-30 10:46:02 +0000
@@ -1,6 +1,7 @@
package com.mysql.cluster.ndbj;
+
/**
* A NdbOperationRef object represents an operation using a primary key to access a row
in a table.
* <br>The main way to use it is to follow the following steps:
@@ -68,6 +69,49 @@
}
}
+
+ public enum AbortOption {
+ DefaultAbortOption(ndbjJNI.NdbOperationImpl_DefaultAbortOption_get()),
+ AbortOnError(ndbjJNI.NdbOperationImpl_AbortOnError_get()),
+ AO_IgnoreError(ndbjJNI.NdbOperationImpl_AO_IgnoreError_get());
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public static AbortOption swigToEnum(int swigValue) {
+ AbortOption[] swigValues = AbortOption.class.getEnumConstants();
+ if (swigValue < swigValues.length && swigValue >= 0 &&
swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (AbortOption swigEnum : swigValues)
+ if (swigEnum.swigValue == swigValue)
+ return swigEnum;
+ throw new IllegalArgumentException("No enum " + AbortOption.class + " with value
" + swigValue);
+ }
+
+ @SuppressWarnings("unused")
+ private AbortOption() {
+ this.swigValue = SwigNext.next++;
+ }
+
+ @SuppressWarnings("unused")
+ private AbortOption(int swigValue) {
+ this.swigValue = swigValue;
+ SwigNext.next = swigValue+1;
+ }
+
+ @SuppressWarnings("unused")
+ private AbortOption(AbortOption swigEnum) {
+ this.swigValue = swigEnum.swigValue;
+ SwigNext.next = this.swigValue+1;
+ }
+
+ private final int swigValue;
+
+ private static class SwigNext {
+ private static int next = 0;
+ }
+ }
/**
* Update a row in the table.
*/
=== modified file 'java/com/mysql/cluster/ndbj/NdbTransaction.java'
--- a/java/com/mysql/cluster/ndbj/NdbTransaction.java 2007-10-05 18:18:53 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbTransaction.java 2007-10-30 10:46:02 +0000
@@ -1,6 +1,7 @@
package com.mysql.cluster.ndbj;
import java.math.BigInteger;
+import com.mysql.cluster.ndbj.NdbOperation.AbortOption;
/**
* An NdbTransactionRef object represents a transaction that can be used
@@ -99,6 +100,50 @@
}
};
+ public enum ExecType {
+ NoExecTypeDef(ndbjJNI.NdbTransactionImpl_NoExecTypeDef_get()),
+ Prepare(ndbjJNI.NdbTransactionImpl_Prepare_get()),
+ NoCommit(ndbjJNI.NdbTransactionImpl_NoCommit_get()),
+ Commit(ndbjJNI.NdbTransactionImpl_Commit_get()),
+ Rollback(ndbjJNI.NdbTransactionImpl_Rollback_get());
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public static ExecType swigToEnum(int swigValue) {
+ ExecType[] swigValues = ExecType.class.getEnumConstants();
+ if (swigValue < swigValues.length && swigValue >= 0 &&
swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (ExecType swigEnum : swigValues)
+ if (swigEnum.swigValue == swigValue)
+ return swigEnum;
+ throw new IllegalArgumentException("No enum " + ExecType.class + " with value
" + swigValue);
+ }
+
+ @SuppressWarnings("unused")
+ private ExecType() {
+ this.swigValue = SwigNext.next++;
+ }
+
+ @SuppressWarnings("unused")
+ private ExecType(int swigValue) {
+ this.swigValue = swigValue;
+ SwigNext.next = swigValue+1;
+ }
+
+ @SuppressWarnings("unused")
+ private ExecType(ExecType swigEnum) {
+ this.swigValue = swigEnum.swigValue;
+ SwigNext.next = this.swigValue+1;
+ }
+
+ private final int swigValue;
+
+ private static class SwigNext {
+ private static int next = 0;
+ }
+ }
/**
* The transaction stores a listt of Blob objects for the transactions.
@@ -252,22 +297,13 @@
* @throws IllegalStateException if the close method has already been called on the
object.
*/
public int restart() throws NdbApiException;
- /**
- * @param execType
- * @param cb
- * @param abortOption
- * @see NdbTransactionRef#executeAsynchPrepare(ExecTypeRef,
- * INdbCallable,
- * AbortOptionRef)
- */
- public void executeAsynchPrepare(ExecType execType, INdbCallable cb, AbortOption
abortOption);
+
/**
* @param execType
* @param cb
* @see NdbTransactionRef#executeAsynchPrepare(ExecTypeRef,
* INdbCallable)
*/
- public void executeAsynchPrepare(ExecType execType, INdbCallable cb);
public NdbOperationImpl getNdbOperation(NdbTable aTable) throws NdbApiException;
public NdbIndexScanOperationImpl getNdbIndexScanOperation(NdbIndex anIndex, NdbTable
aTable) throws NdbApiException;
public NdbIndexOperationImpl getNdbIndexOperation(NdbIndex anIndex, NdbTable aTable)
throws NdbApiException;
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i 2007-10-29 17:52:57 +0000
+++ b/java/ndbj.i 2007-10-30 10:46:02 +0000
@@ -35,7 +35,7 @@
%include "ndbglobals.i"
%include "various.i"
-%include "enums.swg"
+%include "enumtypesafe.swg"
%include "config.h"
@@ -57,26 +57,6 @@
};
-static void JavaCallBack(int result,
- NdbTransaction *trans,
- void *aObject)
-{
-
- asynch_callback_t * callback_data = (asynch_callback_t *)aObject;
-
- JNIEnv *env = callback_data->env;
-
- jclass callablecls = env->GetObjectClass((callback_data->obj));
-
- jmethodID mid = env->GetMethodID(callablecls, "callback", "(ILNdbTransaction;)V");
- if (mid == NULL) {
- jclass clazz = env->FindClass("java/lang/RuntimeException");
- env->ThrowNew(clazz,"No callback method!");
- }
-
- env->CallVoidMethod(callback_data->obj,mid,(jlong)result,trans);
-
-}
static void EventCallBack(NdbEventOperation *theOp,
Ndb *theNdb,
@@ -409,6 +389,12 @@
%typemap(javainterfaces) NdbTransaction "NdbTransaction";
+%typemap(jstype) NdbTransaction::ExecType "NdbTransaction.ExecType"
+%typemap(javaout) NdbTransaction::ExecType {
+ return
NdbTransaction.ExecType.swigToEnum(ndbjJNI.NdbTransactionImpl_getExecType(swigCPtr,
this));
+}
+
+
/*
%javamethodmodifiers NdbTransaction::getNdbIndexOperation(Ndb*, const char*, const char*)
"protected";
%javamethodmodifiers NdbTransaction::getNdbIndexScanOperation(Ndb*, const char*, const
char*) "protected";
@@ -437,13 +423,6 @@
%include "NdbTransaction.i"
-%extend NdbTransaction {
-
- void executeAsynchPrepare(ExecType execType, asynch_callback_t * cb, AbortOption
abortOption = AbortOnError){
- self->executeAsynchPrepare(execType,JavaCallBack,(void *)cb, abortOption);
-
- }
-};
%typemap(javainterfaces) NdbOperation "NdbOperation,NdbInterpretedOperation";
%typemap(javabase) NdbOperation "NdbOperationResultsImpl";
@@ -542,6 +521,12 @@
%rename(realGetValue) getValue(Uint32 anAttrId);
%rename(realGetValue) getValue(const NdbDictColumn* col);
+%typemap(jstype) NdbOperation::AbortOption "NdbOperation.AbortOption";
+%typemap(javaout) NdbOperation::AbortOption {
+ return
NdbOperation.AbortOption.swigToEnum(ndbjJNI.NdbOperationImpl_getAbortOption(swigCPtr,
this));
+}
+
+
%typemap(jstype) NdbOperation::LockMode "NdbOperation.LockMode"
%typemap(javaout) NdbOperation::LockMode {
return
NdbOperation.LockMode.swigToEnum(ndbjJNI.NdbOperationImpl_getLockMode(swigCPtr, this));
=== modified file 'swig/NdbOperation.i'
--- a/swig/NdbOperation.i 2007-10-29 12:32:26 +0000
+++ b/swig/NdbOperation.i 2007-10-30 10:46:02 +0000
@@ -180,6 +180,15 @@
public:
+
+
+ enum AbortOption {
+ DefaultAbortOption = -1,///< Use default as specified by op-type
+ AbortOnError = 0, ///< Abort transaction on failed operation
+ AO_IgnoreError = 2 ///< Transaction continues on failed operation
+ };
+
+
enum Type {
PrimaryKeyAccess = 0,
UniqueIndexAccess = 1,
=== modified file 'swig/NdbTransaction.i'
--- a/swig/NdbTransaction.i 2007-10-23 05:12:33 +0000
+++ b/swig/NdbTransaction.i 2007-10-30 10:46:02 +0000
@@ -25,6 +25,15 @@
public:
+
+ enum ExecType {
+ NoExecTypeDef = -1,
+ Prepare = 0,
+ NoCommit = 1,
+ Commit = 2,
+ Rollback = 3
+ };
+
const NdbError & getNdbError() const;
%ndbexception("NdbApiException") {
@@ -76,8 +85,8 @@
}
}
}
- int execute(ExecType execType,
- AbortOption abortOption = AbortOnError,
+ int execute(NdbTransaction::ExecType execType,
+ NdbOperation::AbortOption abortOption = NdbOperation::AbortOnError,
bool force = 0 );
int restart(void);
int getNdbErrorLine();
@@ -133,11 +142,11 @@
}
*/
%ndbnoexception
- void executeAsynchPrepare(ExecType execType,
- BaseCallback * cb,
- AbortOption abortOption = AbortOnError) {
- self->executeAsynchPrepare(execType,theNdbCallback,(void *)cb,abortOption);
- };
+ void executeAsynchPrepare(NdbTransaction::ExecType execType,
+ BaseCallback * cb,
+ NdbOperation::AbortOption abortOption = NdbOperation::AbortOnError) {
+ self->executeAsynchPrepare(execType,theNdbCallback,(void *)cb,abortOption);
+ };
%ndbexception("NdbApiException") {
=== modified file 'swig/ndbglobals.i'
--- a/swig/ndbglobals.i 2007-10-30 08:55:54 +0000
+++ b/swig/ndbglobals.i 2007-10-30 10:46:02 +0000
@@ -101,21 +101,6 @@
%rename(NdbEvent) NdbDictEvent;
-enum AbortOption {
- CommitIfFailFree = 0,
- TryCommit = 0,
- AbortOnError = 0,
- CommitAsMuchAsPossible = 2,
- AO_IgnoreError = 2
-};
-
-enum ExecType {
- NoExecTypeDef = -1,
- Prepare = 0,
- NoCommit = 1,
- Commit = 2,
- Rollback = 3
-};
typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*);
typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
| Thread |
|---|
| • Rev 222: commiting b0rked change so I can shelve it. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge | Monty Taylor | 30 Oct |