List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:October 24 2007 12:23am
Subject:Rev 195: Fixed autoIncrement. Actually, it wasn't so much broken as my test program was. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors...
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge

------------------------------------------------------------
revno: 195
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Tue 2007-10-23 17:21:46 -0700
message:
  Fixed autoIncrement. Actually, it wasn't so much broken as my test program was.
   But I fixed the test program so now it all works again. (helps to actually declare the
column auto_increment)
modified:
  java/com/mysql/cluster/ndbj/Ndb.java ndb.java-20070517181935-98huwjarzuh25b30-2
  java/com/mysql/cluster/ndbj/examples/TestAsync.java
testasync.java-20070703002120-jsnz1ul38pp1h3w3-1
  swig/Ndb.i                     ndb.i-20070228021421-qkr4cbpxymyqdrf3-1
=== modified file 'java/com/mysql/cluster/ndbj/Ndb.java'
--- a/java/com/mysql/cluster/ndbj/Ndb.java	2007-10-23 23:47:41 +0000
+++ b/java/com/mysql/cluster/ndbj/Ndb.java	2007-10-24 00:21:46 +0000
@@ -109,7 +109,7 @@
      */
     public abstract void close();
     
-    public long getAutoIncrementValue(String aTableName, long cacheSize) throws
NdbApiException;
+    public java.math.BigInteger getAutoIncrementValue(String aTableName, long cacheSize)
throws NdbApiException;
 
     public abstract int sendPollNdb(int aMillisecondNumber) throws NdbApiException;
 
@@ -123,5 +123,5 @@
 
 	public NdbTransaction startTransaction(NdbTable table, int keyData) throws
NdbApiException;
 
-	public long getAutoIncrementValue(NdbTable myTable, long cacheSize) throws
NdbApiException;
+	public java.math.BigInteger getAutoIncrementValue(NdbTable myTable, long cacheSize)
throws NdbApiException;
 }
\ No newline at end of file

=== modified file 'java/com/mysql/cluster/ndbj/examples/TestAsync.java'
--- a/java/com/mysql/cluster/ndbj/examples/TestAsync.java	2007-10-23 23:47:41 +0000
+++ b/java/com/mysql/cluster/ndbj/examples/TestAsync.java	2007-10-24 00:21:46 +0000
@@ -59,7 +59,7 @@
     try { 
       s.executeUpdate("CREATE TABLE " +
 		      table_name + 
-		      "    (ATTR1 INT UNSIGNED," +
+		      "    (ATTR1 INT UNSIGNED auto_increment not null," +
 		      "     ATTR2 INT UNSIGNED NOT NULL," +
 		      "     PRIMARY KEY (ATTR1) )" + 
 		      "  ENGINE=NDBCLUSTER");
@@ -121,7 +121,7 @@
       for(int i=0;i<BATCH_SIZE-offset;i++) { 
 
 
-    	  long auto_id = myNdb.getAutoIncrementValue(myTable,BATCH_SIZE);
+    	  java.math.BigInteger auto_id = myNdb.getAutoIncrementValue(myTable,BATCH_SIZE);
     	  NdbOperation myOperation = myTransaction.getNdbOperation(myTable);
 
     	  myOperation.insertTuple();

=== modified file 'swig/Ndb.i'
--- a/swig/Ndb.i	2007-10-23 23:47:41 +0000
+++ b/swig/Ndb.i	2007-10-24 00:21:46 +0000
@@ -103,31 +103,38 @@
 
 %extend Ndb {
 public:
-  Int64 getAutoIncrementValue(const char* aTableName,
+  %ndbexception("NdbApiException") {
+    $action
+      if (result==0) { 
+	NdbError err = arg1->getNdbError();
+	NDB_exception_err(NdbApiException,err.message,err);
+      }
+  }
+  Uint64 getAutoIncrementValue(const char* aTableName,
                                Uint32 cacheSize) {
   
     Uint64 id = 0;
     int ret = self->getAutoIncrementValue(aTableName,id,cacheSize);
     if (ret == -1) {
-      return 0;
+      return (Uint64)0;
     }
-    return (Int64)id;
+    return id;
   };
-  Int64 getAutoIncrementValue(NdbDictTable * myTable,
+  Uint64 getAutoIncrementValue(NdbDictTable * myTable,
                                Uint32 cacheSize) {
   
     Uint64 id = 0;
     int ret = self->getAutoIncrementValue(myTable,id,cacheSize);
     if (ret == -1) {
-      return 0;
+      return (Uint64)0;
     }
-    return (Int64)id;
+    return id;
   };
   %ndbexception("NdbApiException") {
     $action
       if (result < 0) { 
 	NdbError err = arg1->getNdbError();
-	NDB_exception(NdbApiException,err.message);
+	NDB_exception_err(NdbApiException,err.message,err);
       }
   }
   int pollEvents(int aMillisecondNumber, Uint64 latestGCI=0) { 

Thread
Rev 195: Fixed autoIncrement. Actually, it wasn't so much broken as my test program was. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors...Monty Taylor24 Oct