Merge branch '6.2.x'

This commit is contained in:
Sam Brannen
2025-03-03 14:34:06 +01:00
3 changed files with 13 additions and 2 deletions

View File

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

View File

@@ -85,14 +85,20 @@ public abstract class SqlQuery<T> extends SqlOperation {
* Set the number of rows expected. * Set the number of rows expected.
* <p>This can be used to ensure efficient storage of results. The * <p>This can be used to ensure efficient storage of results. The
* default behavior is not to expect any specific number of rows. * 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) { public void setRowsExpected(int rowsExpected) {
this.rowsExpected = rowsExpected; this.rowsExpected = rowsExpected;
} }
/** /**
* Get the number of rows expected. * 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() { public int getRowsExpected() {
return this.rowsExpected; return this.rowsExpected;
} }

View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -163,6 +163,7 @@ class SqlQueryTests {
} }
@Test @Test
@SuppressWarnings("removal")
void testStringQueryWithResults() throws Exception { void testStringQueryWithResults() throws Exception {
String[] dbResults = new String[] { "alpha", "beta", "charlie" }; String[] dbResults = new String[] { "alpha", "beta", "charlie" };
given(resultSet.next()).willReturn(true, true, true, false); given(resultSet.next()).willReturn(true, true, true, false);