List:Commits« Previous MessageNext Message »
From:Monty Taylor Date:June 30 2008 2:49pm
Subject:bzr commit into NDB/Bindings:trunk branch (monty:438)
View as plain text  
#At https://bazaar.launchpad.net/~ndb-bindings/ndb-bindings/trunk

  438 Monty Taylor	2008-06-30
      Added commitStatus(). 
added:
  java/swig/CommitStatusType.i
modified:
  interface/ndbapi/NdbTransaction.i
  java/com/mysql/cluster/ndbj/NdbTransaction.java
  java/ndbj.i

=== modified file 'interface/ndbapi/NdbTransaction.i'
--- a/interface/ndbapi/NdbTransaction.i	2008-06-30 14:37:18 +0000
+++ b/interface/ndbapi/NdbTransaction.i	2008-06-30 14:48:57 +0000
@@ -35,6 +35,17 @@ public:
   };
 
 
+  /**
+   * The commit status of the transaction.
+   */
+  enum CommitStatusType {
+    NotStarted,                   ///< Transaction not yet started
+    Started,                      ///< <i>Missing explanation</i>
+    Committed,                    ///< Transaction has been committed
+    Aborted,                      ///< Transaction has been aborted
+    NeedAbort                     ///< <i>Missing explanation</i>
+  };
+
 
   const NdbError & getNdbError() const;
 
@@ -106,6 +117,7 @@ public:
   %ndbnoexception;
 
   Uint64 getTransactionId();
+  CommitStatusType commitStatus();
 
 };
 

=== modified file 'java/com/mysql/cluster/ndbj/NdbTransaction.java'
--- a/java/com/mysql/cluster/ndbj/NdbTransaction.java	2008-06-30 14:37:18 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbTransaction.java	2008-06-30 14:48:57 +0000
@@ -21,6 +21,8 @@
 
 package com.mysql.cluster.ndbj;
 
+import java.math.BigInteger;
+
 import javax.transaction.Transaction;
 
 import com.mysql.cluster.ndbj.NdbOperation.AbortOption;
@@ -106,38 +108,39 @@ public interface NdbTransaction extends 
 			this.type = type;
 		}
 	}
-	/**
-	 * This type is used to determine the state of the transaction.
-	 */
-    public enum ExecutionState {
-        /**
-         * The transaction has been started.
-         */
-        STARTED,
-        /**
-         * The transaction has been executed but not committed.
-         */
-        EXECUTED_NOT_COMMITTED,
-        /**
-         * The transaction has been executed and committed.
-         */
-        EXECUTED_COMMITTED,
-        /**
-         * The transaction has been rolled back.
-         */
-        EXECUTED_ROLLED_BACK,
-        /**
-         * The transaction has been closed.
-         */
-        CLOSED,
-        /**
-         * The transaction is in an invalid state.
-         */
-        ERROR;
-
-        private ExecutionState() {
-        }
-    };
+
+
+	public enum CommitStatusType {
+		Started,
+		Committed,
+		Aborted,
+		NeedAbort;
+
+		public int type = 0;
+
+		public int swigValue() {
+			return this.type;
+		}
+
+		private CommitStatusType() {
+			this.type = SwigNext.next++;
+		}
+		
+		private static class SwigNext {
+			private static int next = 0;
+		}
+		public static CommitStatusType swigToEnum(int swigValue) {
+			CommitStatusType[] swigValues = CommitStatusType.class.getEnumConstants();
+			if (swigValue < swigValues.length && swigValue >= 0 
+					&& swigValues[swigValue].swigValue() == swigValue)
+				return swigValues[swigValue];
+			for (CommitStatusType swigEnum : swigValues)
+				if (swigEnum.swigValue() == swigValue)
+					return swigEnum;
+			throw new IllegalArgumentException("No enum " + CommitStatusType.class + " with value " + swigValue);
+		}
+	}
+	
 
     /*
      * The transaction stores a list of Blob objects for the transactions.
@@ -481,14 +484,20 @@ public interface NdbTransaction extends 
      * @throws NdbApiException
      *             if CGI is not available
      */
-    public java.math.BigInteger getGCI() throws NdbApiException;
+    public BigInteger getGCI() throws NdbApiException;
 
     /**
      * Get transaction identity.
      *
      * @return  Transaction id.
      */
-    public java.math.BigInteger getTransactionId();
-
+    public BigInteger getTransactionId();
+    
+    /**
+     * Get the commit status of the transaction.
+     *
+     * @return  The commit status of the transaction
+     */
+    public CommitStatusType commitStatus();
 
 }

=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2008-06-30 13:29:41 +0000
+++ b/java/ndbj.i	2008-06-30 14:48:57 +0000
@@ -109,6 +109,7 @@
 %include "NdbDictionary.i"
 %include "AbortOption.i"
 %include "ExecType.i"
+%include "CommitStatusType.i"
 %include "LockMode.i"
 %include "NdbTransaction.i"
 %include "NdbOperation.i"

=== added file 'java/swig/CommitStatusType.i'
--- a/java/swig/CommitStatusType.i	1970-01-01 00:00:00 +0000
+++ b/java/swig/CommitStatusType.i	2008-06-30 14:48:57 +0000
@@ -0,0 +1,27 @@
+/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+ *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ *  ndb-bindings: Bindings for the NDB API
+ *  Copyright (C) 2008 MySQL
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+%typemap(javaclassmodifiers) enum NdbTransaction::CommitStatusType "protected enum";
+%typemap(jstype) NdbTransaction::CommitStatusType "NdbTransaction.CommitStatusType"
+%typemap(javaout) NdbTransaction::CommitStatusType {
+  return NdbTransaction.CommitStatusType.swigToEnum
+    (ndbjJNI.NdbTransactionImpl_commitStatus(swigCPtr, this));
+ }

Thread
bzr commit into NDB/Bindings:trunk branch (monty:438) Monty Taylor30 Jun