MySQL Forums
Forum List  »  Connector/Node.js

Re: xDev API Java example for using an Array in where clause
Posted by: Rui Quelhas
Date: March 15, 2022 09:12AM

Hi Subramanyam Vummethala,

first I would encourage you to post this in the Connector/J forum (https://forums.mysql.com/list.php?39). However, I'll also try to shed some light on the subject.

As far as I know, at least from the official X DevAPI standpoint, it's not possible to bind multiple values (in the form of an array or something else) to a single X DevAPI expression placeholder.

So, with an "IN" expression, you need to explicitly lay out the entire set of placeholders you want to assign. Then you will have to map out all the values that should be assigned to those placeholders.

For instance, in your example:

find('Role IN [:role1, :role2, :role3, :role4]')
.bind('role1', 'PQR')
.bind('role2', 'XYZ')
.bind('role3', 'MNO')
.bind('role4', 'EFG')

Again, this is a limitation of the current X DevAPI specification, and I suggest you report it under the "MySQL Connectors: Document Store: DevAPI" category using the MySQL bug tracker (https://bugs.mysql.com/).

Hope it helps.


Thanks

Options: ReplyQuote


Subject
Written By
Posted
Re: xDev API Java example for using an Array in where clause
March 15, 2022 09:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.