Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate rowsExpected property of SqlQuery for removal #34526

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -65,7 +65,6 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
* @see #compile
*/
public SqlFunction() {
setRowsExpected(1);
}

/**
Expand All @@ -75,7 +74,6 @@ public SqlFunction() {
* @param sql the SQL to execute
*/
public SqlFunction(DataSource ds, String sql) {
setRowsExpected(1);
setDataSource(ds);
setSql(sql);
}
Expand All @@ -89,7 +87,6 @@ public SqlFunction(DataSource ds, String sql) {
* @see java.sql.Types
*/
public SqlFunction(DataSource ds, String sql, int[] types) {
setRowsExpected(1);
setDataSource(ds);
setSql(sql);
setTypes(types);
Expand All @@ -106,7 +103,6 @@ public SqlFunction(DataSource ds, String sql, int[] types) {
* @see java.sql.Types
*/
public SqlFunction(DataSource ds, String sql, int[] types, Class<T> resultType) {
setRowsExpected(1);
setDataSource(ds);
setSql(sql);
setTypes(types);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@ public SqlQuery(DataSource ds, String sql) {
* 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; it's for internal use only
*/
@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; it's for internal use only
*/
@Deprecated(since = "6.2.4", forRemoval = true)
public int getRowsExpected() {
return this.rowsExpected;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -168,7 +168,6 @@ void testStringQueryWithResults() throws Exception {
given(resultSet.next()).willReturn(true, true, true, false);
given(resultSet.getString(1)).willReturn(dbResults[0], dbResults[1], dbResults[2]);
StringQuery query = new StringQuery(dataSource, SELECT_FORENAME);
query.setRowsExpected(3);
String[] results = query.run();
assertThat(results).isEqualTo(dbResults);
verify(connection).prepareStatement(SELECT_FORENAME);
Expand Down