You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Avinash Dongre <do...@gmail.com> on 2013/04/26 12:25:32 UTC

C++ not sending structure values correctly to Java server

I have following IDL.

struct ColumnValue {
     1: optional bool   bool_val       // BOOLEAN
     2: optional byte   byte_val       // TINYINT
     3: optional i16    i16_val        // SMALLINT
     4: optional i32    i32_val        // INT
     5: optional i64    i64_val        // BIGINT, TIMESTAMP
     6: optional double double_val     // FLOAT, DOUBLE
     7: optional string string_val     // CHAR, VARCHAR
     8: optional binary binary_val     // BINARY
     9: optional BlobLocator blob_val  // BLOB
    10: optional ClobLocator clob_val  // CLOB
}

I am trying to send the list of this ColumnValue to Java Server as follows

for (int id = 1; id <= 100; id++) {

      std::vector<ColumnValue> cvList;

      cvList.push_back(ColumnValue());
      cvList.back().i32_val = id % 98;

      cvList.push_back(ColumnValue());
      cvList.back().i32_val = id;
}

But On Java side when I do following

ColumnValue.getI32_val()

I am always getting 0.

Thanks
Avinash

Re: C++ not sending structure values correctly to Java server

Posted by Avinash Dongre <do...@gmail.com>.
Forget to mention that from Java and Perl Client everything is working fine.


On Fri, Apr 26, 2013 at 3:55 PM, Avinash Dongre <do...@gmail.com>wrote:

> I have following IDL.
>
> struct ColumnValue {
>      1: optional bool   bool_val       // BOOLEAN
>      2: optional byte   byte_val       // TINYINT
>      3: optional i16    i16_val        // SMALLINT
>      4: optional i32    i32_val        // INT
>      5: optional i64    i64_val        // BIGINT, TIMESTAMP
>      6: optional double double_val     // FLOAT, DOUBLE
>      7: optional string string_val     // CHAR, VARCHAR
>      8: optional binary binary_val     // BINARY
>      9: optional BlobLocator blob_val  // BLOB
>     10: optional ClobLocator clob_val  // CLOB
> }
>
> I am trying to send the list of this ColumnValue to Java Server as follows
>
> for (int id = 1; id <= 100; id++) {
>
>       std::vector<ColumnValue> cvList;
>
>       cvList.push_back(ColumnValue());
>       cvList.back().i32_val = id % 98;
>
>       cvList.push_back(ColumnValue());
>       cvList.back().i32_val = id;
> }
>
> But On Java side when I do following
>
> ColumnValue.getI32_val()
>
> I am always getting 0.
>
> Thanks
> Avinash
>
>