MySQL X DevAPI connectors bind dont work with bytes

21 views Asked by At

I have tried both Node.js and C 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 Node.js 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();

And in the C world, this 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?

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

0

There are 0 answers