MySQL X DevAPI connectors bind dont work with bytes
Posted by: Jens hansen
Date: March 24, 2024 08:34AM

Hi there!

I have tried both C and Node.js X DevAPI Connector to connect to my Mysql Document Store server. The connection is established, but the server does not seem to understand my search criteria when I use bytes format.

By byte format, I mean that the following C code does not work:

mysqlx_set_find_criteria(query, "field_name = :param");
mysqlx_stmt_bind(query, "param", PARAM_BYTES(bytes, 3), PARAM_END);

but the following works and seems to do exactly the same as the above:

mysqlx_set_find_criteria(query, "field_name = [12, 4, 0]");
mysqlx_stmt_bind(query, "param", PARAM_BYTES(bytes, 3), PARAM_END);


I don't understand what the problem is and why it can't find the document and what is the idea of 'PARAM_BYTES' if you can't compare field value with bytes?


In the Node.js world the following code does not work::

const result = await collection.find("field_name = :param")
.bind('param', Buffer.from([12, 4, 0]))
.execute();

but the following seems to work and do exactly the same as the above:

const result = await collection.find("field_name = [12, 4, 0]")
.bind('param', Buffer.from([12, 4, 0]))
.execute();

I hope someone can help me and confirm the reason why it doesn't work

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL X DevAPI connectors bind dont work with bytes
321
March 24, 2024 08:34AM


Sorry, only registered users may post in this forum.

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.