From 8661eb9ea13f6a4df0655319f3835dde59b1d00d Mon Sep 17 00:00:00 2001 From: Mirro Mutth Date: Fri, 22 Dec 2023 16:11:41 +0900 Subject: [PATCH] Add TEXT integration and correct README for it --- README.md | 4 +++- .../asyncer/r2dbc/mysql/QueryIntegrationTestSupport.java | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f1194576..967da1942 100644 --- a/README.md +++ b/README.md @@ -547,7 +547,9 @@ If you want to raise an issue, please follow the recommendations below: - The MySQL server does not **actively** return time zone when query `DATETIME` or `TIMESTAMP`, this driver does not attempt time zone conversion. That means should always use `LocalDateTime` for SQL type `DATETIME` or `TIMESTAMP`. Execute `SHOW VARIABLES LIKE '%time_zone%'` to get more information. - Should not turn-on the `trace` log level unless debugging. Otherwise, the security information may be exposed through `ByteBuf` dump. - If `Statement` bound `returnGeneratedValues`, the `Result` of the `Statement` can be called both: `getRowsUpdated` to get affected rows, and `map` to get last inserted ID. -- The MySQL may be not support search rows by a binary field, like `BIT`, `BLOB` and `JSON`, because those data fields maybe just an address of reference in MySQL server, or maybe need strict bit-aligned. (but `VARBINARY` is OK) +- The MySQL may be not support well for searching rows by a binary field, like `BIT` and `JSON` + - `BIT`: cannot select 'BIT(64)' with value greater than 'Long.MAX_VALUE' (or equivalent in binary) + - `JSON`: different MySQL may have different serialization formats, e.g. MariaDB and MySQL ## License diff --git a/src/test/java/io/asyncer/r2dbc/mysql/QueryIntegrationTestSupport.java b/src/test/java/io/asyncer/r2dbc/mysql/QueryIntegrationTestSupport.java index 90b2b405c..d03811faf 100644 --- a/src/test/java/io/asyncer/r2dbc/mysql/QueryIntegrationTestSupport.java +++ b/src/test/java/io/asyncer/r2dbc/mysql/QueryIntegrationTestSupport.java @@ -209,6 +209,13 @@ void varbinary() { ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 })); } + @Test + void text() { + testType(byte[].class, true, "TEXT", null, new byte[0], new byte[] { 1, 2, 3, 4, 5 }); + testType(ByteBuffer.class, true, "TEXT", null, ByteBuffer.allocate(0), + ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 })); + } + @Test void bit() { testType(Boolean.class, true, "BIT(1)", null, false, true);