vertx-jdbc-client icon indicating copy to clipboard operation
vertx-jdbc-client copied to clipboard

Support for storing binary data to blob

Open ca7erina opened this issue 7 years ago • 2 comments

Version

  • vert.x core: 3.4.1
  • vert.x jdbc-client: 3.4.1

General info

  • RDBMS server : MySQL

Context

JsonArray jsonArray = new JsonArray().add(new byte[]{0x00, 0x01, 0x03}); conn.queryWithParams(storeSql, jsonArray, res -> { } );

  • Currently, the byte[] data will be encoded by Base64 and stored to blob. It bring extra effort to encoding and decoding the string.

  • JsonArray doesn't support binary data, the support for blob should also be improved (getBlob()).

ca7erina avatar Oct 19 '17 12:10 ca7erina

The JDBCStatementHelper can take clobs and blobs. What would be useful is to add SQLConnection.createBlob() and sqlConnection.createClob() which call the underlying connection as these are often created using the underlying SQL Connection

rozzamozza avatar Dec 15 '17 10:12 rozzamozza

Actually just spotted the unwrap() method. I.e. you can use Blobs and Clobs in these queryParams connection.unwrap().createBlob()...

Clobs/blobs are automatically freed when added to the statement.

rozzamozza avatar Dec 15 '17 10:12 rozzamozza