You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by Mario Kevo <ma...@est.tech> on 2020/03/11 08:22:22 UTC

Binary data in OQL statement

Hi all,

I have questions about using binary data in OQL statement.
Is binary data supported to be used as a condition in the OQL statement. Something like SELECT * FROM /myregion r WHERE r.p1='BIN_DAT1' and r.p2='BIN_DAT2' when BIN_DAT1 and BIN_DAT2 are both binary data?

Another question is about the primary key. As I explored the header files in the native client, it seems Geode doesn’t support binary as the primary key. I tried setting a binary key like std::string(char*, size) and got std::rang_error. I’m not sure if I use the API in the correct way. Can you confirm this?

Thanks and BR,
Mario

Odg: Binary data in OQL statement

Posted by Mario Kevo <ma...@est.tech>.
Thanks Dan! 🙂
________________________________
Šalje: Dan Smith <ds...@pivotal.io>
Poslano: 11. ožujka 2020. 18:34
Prima: user@geode.apache.org <us...@geode.apache.org>
Predmet: Re: Binary data in OQL statement

I think it's definitely doable, but it might take a wrapper class to check for equality. Assuming r.p1 is a byte[] field, then r.p1=XXX is going to try to use java's equals method for byte[], which is going to compare instances, not bytes. You could wrap the byte[] in an object that implements equals, if you can add objects to server classpath.

-Dan



On Wed, Mar 11, 2020 at 1:22 AM Mario Kevo <ma...@est.tech> wrote:
Hi all,

I have questions about using binary data in OQL statement.
Is binary data supported to be used as a condition in the OQL statement. Something like SELECT * FROM /myregion r WHERE r.p1='BIN_DAT1' and r.p2='BIN_DAT2' when BIN_DAT1 and BIN_DAT2 are both binary data?

Another question is about the primary key. As I explored the header files in the native client, it seems Geode doesn’t support binary as the primary key. I tried setting a binary key like std::string(char*, size) and got std::rang_error. I’m not sure if I use the API in the correct way. Can you confirm this?

Thanks and BR,
Mario

Re: Binary data in OQL statement

Posted by Dan Smith <ds...@pivotal.io>.
I think it's definitely doable, but it might take a wrapper class to check
for equality. Assuming r.p1 is a byte[] field, then r.p1=XXX is going to
try to use java's equals method for byte[], which is going to compare
instances, not bytes. You could wrap the byte[] in an object that
implements equals, if you can add objects to server classpath.

-Dan



On Wed, Mar 11, 2020 at 1:22 AM Mario Kevo <ma...@est.tech> wrote:

> Hi all,
>
> I have questions about using binary data in OQL statement.
> Is binary data supported to be used as a condition in the OQL statement.
> Something like *SELECT * FROM /myregion r WHERE r.p1='BIN_DAT1' and
> r.p2='BIN_DAT2' *when BIN_DAT1 and BIN_DAT2 are both binary data?
>
> Another question is about the primary key. As I explored the header files
> in the native client, it seems Geode doesn’t support binary as the primary
> key. I tried setting a binary key like std::string(char*, size) and got
> std::rang_error. I’m not sure if I use the API in the correct way. Can you
> confirm this?
>
> Thanks and BR,
> Mario
>