Closed gm2552 closed 5 years ago
That would be BLOB maps to either ByteBuffer
or byte[]
and String
for CLOB. Our decision that LOB columns return io.r2dbc.spi.Blob
/Clob
by default was probably premature optimization.
For easier consumption in libraries that apply object mapping, it probably makes sense to introduce scalar value mapping and use scalar values instead of LOB wrappers by default. JDBC behaves in a similar way, BYTEA
(Postgres), VARBINARY(MAX)
(SQL Server), and BLOB
(MySQL) return byte arrays when calling ResultSet.getObject(…)
.
Thoughts? /cc @davecramer @odrotbohm @nebhale @gregturn
In the case of PostgreSQL at least it makes sense to map BYTEA to byte[]
/cc @mirromutth
For now, the default type mapping in r2dbc-mysql
is BLOB
/TEXT
to LOB types and VARBINARY
/VARCHAR
/CHAR
to scalar types.
Yes, I saw mysql-connector-j
which prefer to convert BLOB
to byte[]
, so I vote to use scalar types for default type mappings.
Related to r2dbc-h2 issue https://github.com/r2dbc/r2dbc-h2/issues/115. It is desirable that data field columns of type BLOB and CLOB map to ByteBuffer and byte[] data types in entity objects.