thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khoi Nguyen Minh" <kho...@dkt.com.vn>
Subject RE: Problem with null value in Thrift map
Date Thu, 24 Jun 2010 12:18:25 GMT
Hi Nikhil,

In PHP it's automatic convert to string, so set $data = array('district_id',
1); or $data = array('district_id', '1'); are the same. The problem is when
I set $data = array('district_id', null); then in the server it receive as
empty string '' instead of null value.

Regards,
KhoiNM

-----Original Message-----
From: Nikhil Jindal [mailto:nikhiljindal@google.com] 
Sent: Thursday, June 24, 2010 7:08 PM
To: thrift-user@incubator.apache.org
Subject: Re: Problem with null value in Thrift map

I see no reason why you have 1000 in condition in '', while 1 in data is
not.

On Thu, Jun 24, 2010 at 5:19 PM, Khoi Nguyen Minh <khoinm@dkt.com.vn> wrote:

> Hi all,
>
>
>
> I have a problem with null value in the Thrift map<string, string>.
>
>
>
> For example I have a thrift service file like this:
>
>
>
> typedef map<string, string> StringMap
>
> service TestService {
>
>                i32 updateData(1:string table, 2:StringMap data,
3:StringMap
> condition);
>
> }
>
>
>
> I use PHP for Thrift Client and Java for Thrift Server.
>
>
>
> $table = 'user';
>
> $data = array('district_id', 1);
>
> $condition = array('id', '1000');
>
> $result = $client->updateData($table, $data, $condition);
>
>
>
> Everything OK with this setting, but there's problem when setting $data =
> array('district_id', null);
>
>
>
> In Java Thrift Server, it receive data as district_id = '' and throws
> SQLException (because district_id is int field).
>
> I've test passing null value for $table variable and in the server side it
> receive as null value too.
>
>
>
> Is there something wrong with my thrift map<string, string> ?
>
>
>
> Regards,
>
> KhoiNM
>
>
>
>


Mime
View raw message