You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems a bug because the same query works for all the other databases.
If the table defines a column of type Binary(255) but the query uses a Binary(16), it won't find the row.
It happens in Vert.x 3.9.6 and 4.0.2
@Test
public void testBinaryAsParameter(TestContext ctx) {
// The column is defined as binary(5)
byte[] b = new byte[2];
new Random().nextBytes( b);
Buffer buffer = Buffer.buffer( b );
MySQLConnection.connect(vertx, options, ctx.asyncAssertSuccess(conn -> {
conn.preparedQuery("INSERT INTO datatype (`Binary`, id) VALUES (?,?)").execute( Tuple.of( buffer, 678 ), ctx.asyncAssertSuccess( updateResult -> {
conn.preparedQuery("SELECT `Binary` FROM datatype WHERE `Binary` = ?").execute( Tuple.of( buffer ), ctx.asyncAssertSuccess( result -> {
ctx.assertEquals(1, result.size());
Row row = result.iterator().next();
ctx.assertEquals( buffer, row.getValue( 0 ) );
conn.close();
}));
}));
}));
}
The commit with the change to add the test on the main branch is here: DavideD@1abdfe8
The text was updated successfully, but these errors were encountered:
The BINARY data type value stored in the MySQL database is right padded with zero bytes to the specific length, you will get the same result if you are using jdbc. So you have to pad the param array by yourself in the code to make it correct.
It seems a bug because the same query works for all the other databases.
If the table defines a column of type
Binary(255)
but the query uses aBinary(16)
, it won't find the row.It happens in Vert.x 3.9.6 and 4.0.2
The commit with the change to add the test on the main branch is here: DavideD@1abdfe8
The text was updated successfully, but these errors were encountered: