| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@oshai can you help me with this? Run gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
with:
min-wrapper-count: 1
allow-snapshots: false
env:
JAVA_HOME: /opt/hostedtoolcache/Java_Adopt_jdk/8.0.45[2](https://github.com/jasync-sql/jasync-sql/actions/runs/15515837938/job/43682601835#step:4:2)-9/x64
What do I have to fix? |
Sorry, something went wrong.
I just rerun it, hth. |
Sorry, something went wrong.
|
@oshai Thx. Please review my code then.😃 |
Sorry, something went wrong.
|
I guess for the long run it makes more sense to support in (?) with list support? can mysql client/server protocol pass a list object in one placeholder like that? |
Sorry, something went wrong.
|
It supports the SQL ARRAY data type. However, MySQL doesn't have an ARRAY type, unlike PostgreSQL. So, perhaps I can adapt this code for PostgreSQL? |
Sorry, something went wrong.
|
yes, I think postgres will better fit here. for mysql you can see what the jdbc mysql driver does (it still needs to support arrays) and do something similar. |
Sorry, something went wrong.
|
Hi @oshai, Proposal: Safe List Expansion for IN ClausesAfter careful review, our most robust and safest path forward is to support list expansion for IN clauses exclusively when using named parameters, across all supported databases. This approach aligns with how Spring JDBC handles such scenarios. Why Automatic Expansion for Positional Placeholders is UnsafeAttempting to automatically expand positional ? placeholders is inherently unsafe due to the tight coupling it creates between the Java parameter order and the SQL query's structure. Consider a query like: SET status = ? WHERE id IN (?)If the library were to automatically expand IN (?), it would have to guess the developer's intent based on the parameter order. Should the SQL ever be refactored (e.g., to WHERE id IN (?) SET status = ?), a developer would also need to remember to reorder the Java parameters accordingly. This introduces fragility and makes the code difficult to maintain. The Advantage of Named ParametersNamed parameters, such as :ids, completely eliminate this risk by removing any dependency on parameter order. This ensures clarity and maintainability. Final Implementation PlanBased on this analysis, our final implementation plan is as follows:
This approach allows us to provide a powerful convenience feature—list expansion in IN clauses—in a predictable and safe manner, without the inherent dangers of adding "magic" to ambiguous placeholders. What are your thoughts on this direction? |
Sorry, something went wrong.
|
Currently the driver do not support named params at all. But when using with the r2dbc adapter it add such support iirc. So I don't know if adding such support is beneficial. It will require us in the client side to parse the statement which we don't do right now (might impct performance, be fragile, etc') So I would start with just supporting it in postgres by sending array param. |
Sorry, something went wrong.
@oshai ok~ I see. So in postgres does it gonna change like = ANY(array['Ava', 'Dave']) ? |
Sorry, something went wrong.
|
Not sure I follow. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
This PR adds support for List encoding and resolves mapping issues when using ArrayList with SQL IN clauses.
Key Changes
Added ListEncoder Support in BinaryRowEncoder - Enables conversion of List types to MySQL length-encoded comma-separated strings
Created ListEncoder Tests - Comprehensive test suite verifying various list encoding scenarios (empty lists, single/multiple items, null filtering, etc.)
Implemented ArrayListInClause Tests - Demonstrates the issue with ArrayList in SQL IN clauses and provides two solutions:
Using correct SQL placeholders
Related Issue
#289