List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:July 18 2007 5:29pm
Subject:Rev 124: Added exception wrappers to NdbEventOperation. 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: 124
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Wed 2007-07-18 10:28:48 -0700
message:
  Added exception wrappers to NdbEventOperation.
modified:
  java/com/mysql/cluster/ndbj/NdbEventOperation.java
ndbeventoperation.ja-20070625182612-zsu6r68jih70efaq-1
  swig/NdbEventOperation.i       ndbeventoperation.i-20070625162920-mfe5hei0d2x85mrk-1
=== modified file 'java/com/mysql/cluster/ndbj/NdbEventOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbEventOperation.java	2007-06-25 18:26:16 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbEventOperation.java	2007-07-18 17:28:48 +0000
@@ -8,6 +8,8 @@
 import com.mysql.cluster.ndbapi.NdbEvent.TableEvent;
 import com.mysql.cluster.ndbapi.NdbEventOperation.State;
 
+import com.mysql.cluster.errors.*;
+
 public class NdbEventOperation extends NdbBaseImpl {
 
 	/* (non-Javadoc)
@@ -36,7 +38,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#execute()
 	 */
-	public int execute() {
+	public int execute() throws NdbApiException {
 		return opRef.execute();
 	}
 
@@ -53,7 +55,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getBlobHandle(java.lang.String)
 	 */
-	public NdbBlob getBlobHandle(String anAttrName) {
+	public NdbBlob getBlobHandle(String anAttrName) throws NdbApiException {
 		return opRef.getBlobHandle(anAttrName);
 	}
 
@@ -87,7 +89,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getPreBlobHandle(java.lang.String)
 	 */
-	public NdbBlob getPreBlobHandle(String anAttrName) {
+	public NdbBlob getPreBlobHandle(String anAttrName) throws NdbApiException {
 		return opRef.getPreBlobHandle(anAttrName);
 	}
 
@@ -97,7 +99,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getPreValue(java.lang.String,
java.lang.String)
 	 */
-	public NdbRecAttr getPreValue(String anAttrName, String aValue) {
+	public NdbRecAttr getPreValue(String anAttrName, String aValue) throws NdbApiException {
 		return opRef.getPreValue(anAttrName, aValue);
 	}
 
@@ -106,7 +108,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getPreValue(java.lang.String)
 	 */
-	public NdbRecAttr getPreValue(String anAttrName) {
+	public NdbRecAttr getPreValue(String anAttrName) throws NdbApiException {
 		return opRef.getPreValue(anAttrName);
 	}
 
@@ -124,7 +126,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getValue(java.lang.String,
java.lang.String)
 	 */
-	public NdbRecAttr getValue(String anAttrName, String aValue) {
+	public NdbRecAttr getValue(String anAttrName, String aValue) throws NdbApiException {
 		return opRef.getValue(anAttrName, aValue);
 	}
 
@@ -133,7 +135,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#getValue(java.lang.String)
 	 */
-	public NdbRecAttr getValue(String anAttrName) {
+	public NdbRecAttr getValue(String anAttrName) throws NdbApiException {
 		return opRef.getValue(anAttrName);
 	}
 
@@ -149,7 +151,7 @@
 	 * @return
 	 * @see com.mysql.cluster.ndbapi.NdbEventOperation#isOverrun()
 	 */
-	public int isOverrun() {
+	public int isOverrun() throws NdbApiException {
 		return opRef.isOverrun();
 	}
 

=== modified file 'swig/NdbEventOperation.i'
--- a/swig/NdbEventOperation.i	2007-06-25 16:54:09 +0000
+++ b/swig/NdbEventOperation.i	2007-07-18 17:28:48 +0000
@@ -25,47 +25,20 @@
     EO_DROPPED,   ///< Waiting to be deleted, Object unusable.
     EO_ERROR      ///< An error has occurred. Object unusable.
   };
-  /**
-   * Retrieve current state of the NdbEventOperation object
-   */
-  State getState();
-  /**
-   * See NdbDictionary::Event.  Default is false.
-   */
-  void mergeEvents(bool flag);
-
-  /**
-   * Activates the NdbEventOperation to start receiving events. The
-   * changed attribute values may be retrieved after Ndb::nextEvent() 
-   * has returned not NULL. The getValue() methods must be called
-   * prior to execute().
+
+
+  %ndbnoexception; 
+
+  /**
+   * Get the latest error
    *
-   * @return 0 if successful otherwise -1.
-   */
-  int execute();
-
-
-  NdbRecAttr *getValue(const char *anAttrName, char *aValue = 0);
-  /**
-   * See getValue().
-   */
-  NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0);
-  NdbBlob* getBlobHandle(const char *anAttrName);
-  NdbBlob* getPreBlobHandle(const char *anAttrName);
-
-  int isOverrun() const;
+   * @return   Error object.
+   */
+  const struct NdbError & getNdbError() const;
+
   bool isConsistent() const;
 
   /**
-   * Query for occured event type.
-   *
-   * @note Only valid after Ndb::nextEvent() has been called and 
-   * returned a not NULL value
-   *
-   * @return type of event
-   */
-  NdbDictEvent::TableEvent getEventType() const;
-  /**
    * Check if table name has changed, for event TE_ALTER
    */
   const bool tableNameChanged() const;
@@ -84,6 +57,7 @@
    * Check if table range partition list name has changed, for event TE_ALTER
    */
   const bool tableRangeListChanged() const;
+
   /**
    * Retrieve the GCI of the latest retrieved event
    *
@@ -106,11 +80,68 @@
   Uint64 getLatestGCI() const;
 
   /**
-   * Get the latest error
-   *
-   * @return   Error object.
-   */
-  const struct NdbError & getNdbError() const;
+   * Retrieve current state of the NdbEventOperation object
+   */
+  State getState();
+
+
+  /**
+   * See NdbDictionary::Event.  Default is false.
+   */
+  void mergeEvents(bool flag);
+
+  /**
+   * Query for occured event type.
+   *
+   * @note Only valid after Ndb::nextEvent() has been called and 
+   * returned a not NULL value
+   *
+   * @return type of event
+   */
+  NdbDictEvent::TableEvent getEventType() const;
+
+
+  /* methods that return an object */
+  %ndbexception("NdbApiException") {
+    $action
+      if (result == NULL) { 
+        NdbError err = arg1->getNdbError();
+	NDB_exception(NdbApiException,err.message);
+      }
+  }
+
+  NdbRecAttr *getValue(const char *anAttrName, char *aValue = 0);
+  /**
+   * See getValue().
+   */
+  NdbRecAttr *getPreValue(const char *anAttrName, char *aValue = 0);
+  NdbBlob* getBlobHandle(const char *anAttrName);
+  NdbBlob* getPreBlobHandle(const char *anAttrName);
+
+
+
+  /* methods that return an object */
+  %ndbexception("NdbApiException") {
+    $action
+      if (result == -1) { 
+        NdbError err = arg1->getNdbError();
+	NDB_exception(NdbApiException,err.message);
+      }
+  }
+
+  /**
+   * Activates the NdbEventOperation to start receiving events. The
+   * changed attribute values may be retrieved after Ndb::nextEvent() 
+   * has returned not NULL. The getValue() methods must be called
+   * prior to execute().
+   *
+   * @return 0 if successful otherwise -1.
+   */
+  int execute();
+
+  int isOverrun() const;
+
+  %ndbnoexception; 
 
 private: 
   NdbEventOperation(Ndb *theNdb, const char* eventName);

Thread
Rev 124: Added exception wrappers to NdbEventOperation. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor18 Jul