Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@
<spotless.eclipse.version>4.40</spotless.eclipse.version>
</properties>

<dependencyManagement>
<dependencies>
<!--
Testcontainers pulls commons-compress 1.24.0, which carries
CVE-2024-25710 and CVE-2024-26308. Both are fixed in 1.26.0.
-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.28.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>info.picocli</groupId>
Expand Down Expand Up @@ -46,6 +60,18 @@
<version>2.4.240</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.21.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.13</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/dev/sqlcj/generator/JavaCodeGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,16 @@ private boolean isLineEnd(String sql, int index) {
/**
* Renders the executor arguments in the textual order of the JDBC
* {@code ?} positions, using the logically ordered method parameter names.
*
* <p>The argument list is built with {@code java.util.Arrays.asList} rather
* than {@code List.of} so that a null argument can be bound.
*/
private String generateParameterList(QueryModel query, JavaNames names) {
Map<Integer, String> namesByIndex = generateParameterNamesByIndex(query, names);

return query.bindingParameterIndexes().stream()
.map(namesByIndex::get)
.collect(Collectors.joining(", ", "List.of(", ")"));
.collect(Collectors.joining(", ", "java.util.Arrays.asList(", ")"));
}

private Map<Integer, String> generateParameterNamesByIndex(QueryModel query, JavaNames names) {
Expand Down
Loading
Loading