At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
------------------------------------------------------------
revno: 284
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Fri 2007-11-23 20:14:32 -0800
message:
Fixed a silly malloc call that was mallocing more memory than we needed.
Added NdbOperation::getTable()
Started work on NdbBlob:java.sql.Blob
modified:
ChangeLog changelog-20070228020914-u2pk759xg7thauwf-2
interface/ndbapi/NdbOperation.i ndboperation.i-20070228021421-qkr4cbpxymyqdrf3-3
interface/ndbapi/NdbRecAttr.i ndbrecattr.i-20070228021421-qkr4cbpxymyqdrf3-4
java/.classpath classpath-20071116042946-npnq9g3hwm24x1ga-1
java/com/mysql/cluster/ndbj/NdbBaseOperation.java
ndbbaseoperation.jav-20070517181935-98huwjarzuh25b30-5
java/ndbj.i ndbj.i-20070913223244-5938mztpztyn9sry-1
=== modified file 'ChangeLog'
--- a/ChangeLog 2007-11-23 20:50:11 +0000
+++ b/ChangeLog 2007-11-24 04:14:32 +0000
@@ -1,9 +1,8 @@
-Added NdbOperation::getTable()
-Added NdbResultSetMetaData
Made NdbBlob implement java.sql.Blob and NdbResultSet implement
java.sql.ResultSet.
Made NdbApiException implement SQLException
Fixed a silly malloc call that was mallocing more memory than we needed.
+Added NdbOperation::getTable()
0.5.1.22.3:
Fixed BUG#32669 ndb-connectors rely on not yet standard map::at() method
Fixed BUG#32671 ndb-connector java compilation fails with "/bin/sh: no:
@@ -13,6 +12,7 @@
0.5.1.22.1:
Fixed problem with automake 1.9
Cleaned up old javadoc references to Ref classes.
+Added NdbResultSetMetaData
0.5.1.22.0:
Initial Release. All major pieces work in Java, and should work in
Python and Ruby. Anything that doens't work should be considered a bug.
=== modified file 'interface/ndbapi/NdbOperation.i'
--- a/interface/ndbapi/NdbOperation.i 2007-11-06 22:59:00 +0000
+++ b/interface/ndbapi/NdbOperation.i 2007-11-24 04:14:32 +0000
@@ -70,7 +70,7 @@
return NULL;
} else {
// Need one space for the length
- char * buf = (char *)malloc((len+1)*sizeof(char *));
+ char * buf = (char *)malloc((len+1));
unsigned char lowb=len;
buf[0]=lowb;
memcpy(buf+1, aString, len);
@@ -204,6 +204,7 @@
// void setPartitionHash(const Uint64 *, Uint32 len);
Uint32 getPartitionId() const;
+ const NdbDictTable * getTable() const;
%ndbexception("NdbApiException") {
$action
=== modified file 'interface/ndbapi/NdbRecAttr.i'
--- a/interface/ndbapi/NdbRecAttr.i 2007-11-06 22:59:00 +0000
+++ b/interface/ndbapi/NdbRecAttr.i 2007-11-24 04:14:32 +0000
@@ -50,8 +50,13 @@
%rename(get_uchar) u_char_value() const;
%rename(get_float) float_value() const;
%rename(get_double) double_value() const;
+ %rename(getSizeInBytes) get_size_in_bytes() const;
#endif
+ %ndbexception("NdbApiException") {
+ $action
+ }
+
Int64 int64_value();
Int32 int32_value();
short short_value();
@@ -65,7 +70,12 @@
char* aRef() const;
-
+ %ndbnoexception;
+
+ const NdbDictColumn * getColumn() const;
+ NdbDictColumn::Type getType() const;
+
+ Uint32 get_size_in_bytes() const;
};
%extend NdbRecAttr {
@@ -138,7 +148,7 @@
if(colType == NdbDictionary::Column::Longvarchar)
{
int len=(int)uint2korr(ref);
- char * buff = (char *)malloc((len+1)*sizeof(char *));
+ char * buff = (char *)malloc(len+1);
memset(buff,0,len+1);
ref+=2;
memcpy(buff,ref,len);
@@ -148,7 +158,7 @@
else if(colType == NdbDictionary::Column::Varchar)
{
short len = (short) (unsigned char) (ref[0]);
- char * buff = (char *)malloc((len+1)*sizeof(char *));
+ char * buff = (char *)malloc(len+1);
memset(buff,0, len+1);
memcpy(buff,++ref,len);
buff[len+1]='\0';
@@ -167,7 +177,7 @@
i--;
}
i++; //length of string until space padding starts..
- char * buff = (char *)malloc((i+1)*sizeof(char *)); //+1 for null;
+ char * buff = (char *)malloc(i+1); //+1 for null;
memcpy(buff, ref, i);
buff[i]='\0';
return buff;
=== modified file 'java/.classpath'
--- a/java/.classpath 2007-11-16 05:01:53 +0000
+++ b/java/.classpath 2007-11-24 04:14:32 +0000
@@ -7,6 +7,6 @@
</classpathentry>
<classpathentry kind="lib" path="lib/mysql-connector-java-5.0.4-bin.jar"/>
<classpathentry kind="lib" path="/usr/share/java/junit.jar"/>
- <classpathentry kind="lib" path="/usr/lib/jvm/java-1.5.0-sun/jre/lib/rt.jar"/>
+ <classpathentry kind="lib" path="/usr/lib/jvm/java-6-sun/jre/lib/rt.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
=== modified file 'java/com/mysql/cluster/ndbj/NdbBaseOperation.java'
--- a/java/com/mysql/cluster/ndbj/NdbBaseOperation.java 2007-11-20 02:32:41 +0000
+++ b/java/com/mysql/cluster/ndbj/NdbBaseOperation.java 2007-11-24 04:14:32 +0000
@@ -399,6 +399,7 @@
* @throws NdbApiException if there was a problem in the cluster when trying to set a
value for a column.
*/
public void setNull(String columnName) throws NdbApiException;
+ public NdbTable getTable();
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i 2007-11-15 18:49:30 +0000
+++ b/java/ndbj.i 2007-11-24 04:14:32 +0000
@@ -98,14 +98,19 @@
}
void ndb_throw_exception(JNIEnv *jenv, const char * excp, const char *msg, NdbError &
err) {
+ jclass clazz = NULL;
const char * prefix = "com/mysql/cluster/ndbj/";
- char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
- strcpy(exception,prefix);
- strcat(exception,excp);
-
- //jclass clazz = jenv->FindClass("java/lang/RuntimeException");
- jclass clazz = jenv->FindClass(exception);
- free(exception);
+ if (strncmp(excp,"com.",4)) {
+ clazz = jenv->FindClass(excp);
+ } else {
+ char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
+ strcpy(exception,prefix);
+ strcat(exception,excp);
+
+ //jclass clazz = jenv->FindClass("java/lang/RuntimeException");
+ clazz = jenv->FindClass(exception);
+ free(exception);
+ }
jlong errPtr = 0;
NdbError * result = new NdbError(err);
@@ -586,6 +591,16 @@
%include "ndbapi/NdbRecAttr.i"
+%typemap(javaimports) NdbBlob %{
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.SQLException;
+ %}
+
%typemap(javacode) NdbBlob %{
private byte[] theBlob;
@@ -598,6 +613,174 @@
this.readData(theBlob, theBlob.length);
return theBlob;
}
+ /* (non-Javadoc)
+ * @see java.sql.Blob#free()
+ */
+ public void free() throws NdbApiException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#getBinaryStream(long, long)
+ */
+ public InputStream getBinaryStream(long arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#getCharacterStream(long, long)
+ */
+ public Reader getCharacterStream(long arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#getAsciiStream()
+ */
+ public InputStream getAsciiStream() throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#getCharacterStream()
+ */
+ public Reader getCharacterStream() throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#getSubString(long, int)
+ */
+ public String getSubString(long arg0, int arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#position(java.sql.Clob, long)
+ */
+ public long position(Clob arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#position(java.lang.String, long)
+ */
+ public long position(String arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#setAsciiStream(long)
+ */
+ public OutputStream setAsciiStream(long arg0) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#setCharacterStream(long)
+ */
+ public Writer setCharacterStream(long arg0) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#setString(long, java.lang.String)
+ */
+ public int setString(long arg0, String arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Clob#setString(long, java.lang.String, int, int)
+ */
+ public int setString(long arg0, String arg1, int arg2, int arg3) throws NdbApiException
{
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#getBinaryStream()
+ */
+ public InputStream getBinaryStream() throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#getBytes(long, int)
+ */
+ public byte[] getBytes(long arg0, int arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#length()
+ */
+ public long length() throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#position(byte[], long)
+ */
+ public long position(byte[] arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#position(java.sql.Blob, long)
+ */
+ public long position(Blob arg0, long arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#setBinaryStream(long)
+ */
+ public OutputStream setBinaryStream(long arg0) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#setBytes(long, byte[])
+ */
+ public int setBytes(long arg0, byte[] arg1) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#setBytes(long, byte[], int, int)
+ */
+ public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws NdbApiException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.sql.Blob#truncate(long)
+ */
+ public void truncate(long arg0) throws NdbApiException {
+ // TODO Auto-generated method stub
+
+ }
+
%}
%typemap(javainterfaces) NdbBlob "NdbBlob";
| Thread |
|---|
| • Rev 284: Fixed a silly malloc call that was mallocing more memory than we needed. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel | Monty Taylor | 24 Nov |