List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:July 12 2007 8:29pm
Subject:Rev 141: Fixed a bunch of smaller bugs reported by Johan. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmerge
View as plain text  
------------------------------------------------------------
revno: 141
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: ndbjmerge
timestamp: Thu 2007-07-12 15:28:26 -0500
message:
  Fixed a bunch of smaller bugs reported by Johan. 
  Actually added the --with-java check the last autoconf fix thought was there. :)
modified:
  acinclude.m4                   acinclude.m4-20070228020914-u2pk759xg7thauwf-8
  configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
  java/ndbapi.i                  ndbapi.i-20070130002924-gcvhapmvh0lu1pkd-3
  swig/Ndb.i                     ndb.i-20070228021421-qkr4cbpxymyqdrf3-1
  swig/NdbDictionary.i           ndbdictionary.i-20070323110251-l7mg72hiddtuzeh0-1
  swig/NdbOperation.i            ndboperation.i-20070228021421-qkr4cbpxymyqdrf3-3
=== modified file 'acinclude.m4'
--- a/acinclude.m4	2007-05-04 20:45:38 +0000
+++ b/acinclude.m4	2007-07-12 20:28:26 +0000
@@ -57,6 +57,42 @@
 ])
 
 
+AC_DEFUN([WITH_JAVA], [
+
+  AC_ARG_WITH(java, [  --with-java=PATH	path to ruby binary], 
+  with_java=$withval, with_java="yes")
+
+if test "$with_java" = "yes" ; then
+  AC_PROG_JAVAC()
+  if test "x$JAVAC" == "x"  ; then
+    AC_MSG_ERROR([Couldn't find javac.])
+  fi
+  AC_PROG_JAR()
+  if test "x$JAR" == "x"  ; then
+    AC_MSG_ERROR([Couldn't find jar.])
+  fi
+  AC_PROG_JAVA()
+  if test "x$JAVA" == "x"  ; then
+    AC_MSG_ERROR([Couldn't find java.])
+  fi
+  AC_CHECK_PROGS(ANT,ant)
+  if test "x$ANT" == "x"  ; then
+    AC_MSG_ERROR([Couldn't find ant.])
+  fi
+  AC_CHECK_JUNIT()
+  AC_JNI_INCLUDE_DIR()
+  if test "x${JNI_INCLUDE_DIRS}" == "x"  ; then
+    AC_MSG_ERROR([Couldn't find JNI includes .])
+  fi 
+fi 
+
+
+for JNI_INCLUDE_DIR in ${JNI_INCLUDE_DIRS} ; do
+  JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR"
+done
+
+])
+
 AC_DEFUN([WITH_RUBY], [
 
   AC_ARG_WITH(ruby, [  --with-ruby=PATH	path to ruby binary], 

=== modified file 'configure.in'
--- a/configure.in	2007-07-12 19:57:00 +0000
+++ b/configure.in	2007-07-12 20:28:26 +0000
@@ -34,36 +34,7 @@
 
 AC_PROG_LIBTOOL()
 
-
-
-if test "$with_java" = "yes" ; then
-  AC_PROG_JAVAC()
-  if test "x$JAVAC" == "x"  ; then
-    AC_MSG_ERROR([Couldn't find javac.])
-  fi
-  AC_PROG_JAR()
-  if test "x$JAR" == "x"  ; then
-    AC_MSG_ERROR([Couldn't find jar.])
-  fi
-  AC_PROG_JAVA()
-  if test "x$JAVA" == "x"  ; then
-    AC_MSG_ERROR([Couldn't find java.])
-  fi
-  AC_CHECK_PROGS(ANT,ant)
-  if test "x$ANT" == "x"  ; then
-    AC_MSG_ERROR([Couldn't find ant.])
-  fi
-  AC_CHECK_JUNIT()
-  AC_JNI_INCLUDE_DIR
-  if test "x${JNI_INCLUDE_DIRS}" == "x"  ; then
-    AC_MSG_ERROR([Couldn't find JNI includes .])
-  fi 
-fi 
-
-
-for JNI_INCLUDE_DIR in ${JNI_INCLUDE_DIRS} ; do
-  JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR"
-done
+WITH_JAVA()
 
 # TODO: check for Python.h
 # Check for setuptools

=== modified file 'java/ndbapi.i'
--- a/java/ndbapi.i	2007-07-03 00:41:04 +0000
+++ b/java/ndbapi.i	2007-07-12 20:28:26 +0000
@@ -66,6 +66,8 @@
 
   //jclass clazz = jenv->FindClass("java/lang/RuntimeException");
   jclass clazz = jenv->FindClass(exception);
+  free(exception);
+
   jenv->ThrowNew(clazz,msg);
 }
  %}

=== modified file 'swig/Ndb.i'
--- a/swig/Ndb.i	2007-06-25 18:26:16 +0000
+++ b/swig/Ndb.i	2007-07-12 20:28:26 +0000
@@ -42,6 +42,7 @@
 	NDB_exception(NdbApiException,err.message);
       }
   }
+  int dropEventOperation(NdbEventOperation* eventOp);
   int  sendPollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT,
 		   int minNoOfEventsToWakeup = 1,
 		   int forceSend = 0);
@@ -84,7 +85,6 @@
 /* Events */
 
   NdbEventOperation* createEventOperation(const char* eventName);
-  int dropEventOperation(NdbEventOperation* eventOp);
 
 //  int pollEvents(int aMillisecondNumber, Uint64 *latestGCI= 0);
 
@@ -98,28 +98,6 @@
 
 %extend Ndb {
 public:
-  int pollEvents(int aMillisecondNumber, Uint64 latestGCI=0) { 
-    return self->pollEvents(aMillisecondNumber,&latestGCI);
-
-  }
-  const NdbEventOperation*
-    getGCIEventOperations(Uint32 iter, Uint32 event_types) {
-    return self->getGCIEventOperations(&iter,&event_types);
-  }
-
-  NdbTransaction* startTransaction(const char* aTableName, 
-                                   const char *keyData) {
-    const NdbDictDictionary *myDict = self->getDictionary();
-    const NdbDictTable *myTable = myDict->getTable(aTableName);
-    return self->startTransaction(myTable,keyData);
-  }
-  NdbTransaction* startTransaction(const char* aTableName, 
-                                   int keyData) {
-    const NdbDictDictionary *myDict = self->getDictionary();
-    const NdbDictTable *myTable = myDict->getTable(aTableName);
-    return self->startTransaction(myTable,(const char *) &keyData);
-  }
-
   Uint64 getAutoIncrementValue(const char* aTableName,
                                Uint32 cacheSize) {
   
@@ -130,5 +108,41 @@
     }
     return id;
   };
+  %ndbexception("NdbApiException") {
+    $action
+      if (result < 0) { 
+	NdbError err = arg1->getNdbError();
+	NDB_exception(NdbApiException,err.message);
+      }
+  }
+  int pollEvents(int aMillisecondNumber, Uint64 latestGCI=0) { 
+    return self->pollEvents(aMillisecondNumber,&latestGCI);
+
+  }
+  %ndbexception("NdbApiException") {
+    $action
+      if (result == NULL) { 
+	NdbError err = arg1->getNdbError();
+	NDB_exception(NdbApiException,err.message);
+      }
+  }
+  const NdbEventOperation*
+    getGCIEventOperations(Uint32 iter, Uint32 event_types) {
+    return self->getGCIEventOperations(&iter,&event_types);
+  }
+
+  NdbTransaction* startTransaction(const char* aTableName, 
+                                   const char *keyData) {
+    const NdbDictDictionary *myDict = self->getDictionary();
+    const NdbDictTable *myTable = myDict->getTable(aTableName);
+    return self->startTransaction(myTable,keyData);
+  }
+  NdbTransaction* startTransaction(const char* aTableName, 
+                                   int keyData) {
+    const NdbDictDictionary *myDict = self->getDictionary();
+    const NdbDictTable *myTable = myDict->getTable(aTableName);
+    return self->startTransaction(myTable,(const char *) &keyData);
+  }
+
 };
 

=== modified file 'swig/NdbDictionary.i'
--- a/swig/NdbDictionary.i	2007-06-28 18:30:30 +0000
+++ b/swig/NdbDictionary.i	2007-07-12 20:28:26 +0000
@@ -354,6 +354,7 @@
   const NdbDictTable * getTable(const char * name) const;
   const NdbDictIndex * getIndex(const char * indexName,
 				const char * tableName) const;
+  const NdbDictEvent * getEvent(const char * eventName);
 #if defined(MYSQL_50)
   const NdbDictIndex * getIndex(const char * indexName,
 				const NdbDictTable & table) const;
@@ -367,6 +368,8 @@
       }
   }
   
+  int createEvent(const NdbDictEvent &event);
+  int dropEvent(const char * eventName);
   int createTable(const NdbDictTable &table);
   int dropTable(NdbDictTable & table);
   int dropTable(const char * name);

=== modified file 'swig/NdbOperation.i'
--- a/swig/NdbOperation.i	2007-06-29 23:04:54 +0000
+++ b/swig/NdbOperation.i	2007-07-12 20:28:26 +0000
@@ -96,7 +96,7 @@
     {
       //printf("it's a long varchar\n");
       char* buf=(char *)malloc(len+2);
-      memset(buf,' ',len+2);
+      memset(buf,0,len+2);
       unsigned char lowb=len & 0xff;
       unsigned char highb=len << 8;
       buf[1]=highb;
@@ -106,13 +106,23 @@
     }
     break;
     case NDB_TYPE_CHAR:
+      if (len>255) {
+	return NULL;
+      } else {
+	int colLength = theColumn->getLength(); 
+	char * buf = (char *)malloc(colLength+1);
+	memset(buf, ' ', colLength);
+	memcpy(buf, aString, len);
+	return buf;
+      }
+      break;
     case NDB_TYPE_BINARY:
       if (len>255) {
 	return NULL;
       } else {
 	int colLength = theColumn->getLength(); 
 	char * buf = (char *)malloc(colLength+1);
-	memset(buf, ' ', colLength);
+	memset(buf, 0, colLength);
 	memcpy(buf, aString, len);
 	return buf;
       }

Thread
Rev 141: Fixed a bunch of smaller bugs reported by Johan. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/ndbjmergeMonty Taylor12 Jul