Browse Source

Merge branch '6.2.x'

pull/34532/head
Sam Brannen 10 months ago
parent
commit
e9345f16dc
  1. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java
  2. 6
      spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java
  3. 3
      spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java

6
spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -64,6 +64,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> { @@ -64,6 +64,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* @see #setSql
* @see #compile
*/
@SuppressWarnings("removal")
public SqlFunction() {
setRowsExpected(1);
}
@ -74,6 +75,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> { @@ -74,6 +75,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* @param ds the DataSource to obtain connections from
* @param sql the SQL to execute
*/
@SuppressWarnings("removal")
public SqlFunction(DataSource ds, String sql) {
setRowsExpected(1);
setDataSource(ds);
@ -88,6 +90,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> { @@ -88,6 +90,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* {@code java.sql.Types} class
* @see java.sql.Types
*/
@SuppressWarnings("removal")
public SqlFunction(DataSource ds, String sql, int[] types) {
setRowsExpected(1);
setDataSource(ds);
@ -105,6 +108,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> { @@ -105,6 +108,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* @see #setResultType(Class)
* @see java.sql.Types
*/
@SuppressWarnings("removal")
public SqlFunction(DataSource ds, String sql, int[] types, Class<T> resultType) {
setRowsExpected(1);
setDataSource(ds);

6
spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java

@ -85,14 +85,20 @@ public abstract class SqlQuery<T> extends SqlOperation { @@ -85,14 +85,20 @@ public abstract class SqlQuery<T> extends SqlOperation {
* Set the number of rows expected.
* <p>This can be used to ensure efficient storage of results. The
* default behavior is not to expect any specific number of rows.
* @deprecated since 6.2.4 with no replacement since the property has never
* had any affect on behavior; to be removed in 7.0
*/
@Deprecated(since = "6.2.4", forRemoval = true)
public void setRowsExpected(int rowsExpected) {
this.rowsExpected = rowsExpected;
}
/**
* Get the number of rows expected.
* @deprecated since 6.2.4 with no replacement since the property has never
* had any affect on behavior; to be removed in 7.0
*/
@Deprecated(since = "6.2.4", forRemoval = true)
public int getRowsExpected() {
return this.rowsExpected;
}

3
spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -163,6 +163,7 @@ class SqlQueryTests { @@ -163,6 +163,7 @@ class SqlQueryTests {
}
@Test
@SuppressWarnings("removal")
void testStringQueryWithResults() throws Exception {
String[] dbResults = new String[] { "alpha", "beta", "charlie" };
given(resultSet.next()).willReturn(true, true, true, false);

Loading…
Cancel
Save