Skip to content

Commit 5ffd88c

Browse files
sbrannenquaff
andcommitted
Remove deprecated rowsExpected property of SqlQuery
Closes gh-34530 Co-authored-by: Yanming Zhou <[email protected]>
1 parent e9345f1 commit 5ffd88c

File tree

3 files changed

+0
-38
lines changed

3 files changed

+0
-38
lines changed

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java

-8
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
6464
* @see #setSql
6565
* @see #compile
6666
*/
67-
@SuppressWarnings("removal")
6867
public SqlFunction() {
69-
setRowsExpected(1);
7068
}
7169

7270
/**
@@ -75,9 +73,7 @@ public SqlFunction() {
7573
* @param ds the DataSource to obtain connections from
7674
* @param sql the SQL to execute
7775
*/
78-
@SuppressWarnings("removal")
7976
public SqlFunction(DataSource ds, String sql) {
80-
setRowsExpected(1);
8177
setDataSource(ds);
8278
setSql(sql);
8379
}
@@ -90,9 +86,7 @@ public SqlFunction(DataSource ds, String sql) {
9086
* {@code java.sql.Types} class
9187
* @see java.sql.Types
9288
*/
93-
@SuppressWarnings("removal")
9489
public SqlFunction(DataSource ds, String sql, int[] types) {
95-
setRowsExpected(1);
9690
setDataSource(ds);
9791
setSql(sql);
9892
setTypes(types);
@@ -108,9 +102,7 @@ public SqlFunction(DataSource ds, String sql, int[] types) {
108102
* @see #setResultType(Class)
109103
* @see java.sql.Types
110104
*/
111-
@SuppressWarnings("removal")
112105
public SqlFunction(DataSource ds, String sql, int[] types, Class<T> resultType) {
113-
setRowsExpected(1);
114106
setDataSource(ds);
115107
setSql(sql);
116108
setTypes(types);

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java

-27
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@
5757
*/
5858
public abstract class SqlQuery<T> extends SqlOperation {
5959

60-
/** The number of rows to expect; if 0, unknown. */
61-
private int rowsExpected = 0;
62-
63-
6460
/**
6561
* Constructor to allow use as a JavaBean.
6662
* <p>The {@code DataSource} and SQL must be supplied before
@@ -81,29 +77,6 @@ public SqlQuery(DataSource ds, String sql) {
8177
}
8278

8379

84-
/**
85-
* Set the number of rows expected.
86-
* <p>This can be used to ensure efficient storage of results. The
87-
* default behavior is not to expect any specific number of rows.
88-
* @deprecated since 6.2.4 with no replacement since the property has never
89-
* had any affect on behavior; to be removed in 7.0
90-
*/
91-
@Deprecated(since = "6.2.4", forRemoval = true)
92-
public void setRowsExpected(int rowsExpected) {
93-
this.rowsExpected = rowsExpected;
94-
}
95-
96-
/**
97-
* Get the number of rows expected.
98-
* @deprecated since 6.2.4 with no replacement since the property has never
99-
* had any affect on behavior; to be removed in 7.0
100-
*/
101-
@Deprecated(since = "6.2.4", forRemoval = true)
102-
public int getRowsExpected() {
103-
return this.rowsExpected;
104-
}
105-
106-
10780
/**
10881
* Central execution method. All un-named parameter execution goes through this method.
10982
* @param params parameters, similar to JDO query parameters.

Diff for: spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java

-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
*/
5656
class SqlQueryTests {
5757

58-
// FIXME inline?
5958
private static final String SELECT_ID =
6059
"select id from custmr";
6160
private static final String SELECT_ID_WHERE =
@@ -163,13 +162,11 @@ protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
163162
}
164163

165164
@Test
166-
@SuppressWarnings("removal")
167165
void testStringQueryWithResults() throws Exception {
168166
String[] dbResults = new String[] { "alpha", "beta", "charlie" };
169167
given(resultSet.next()).willReturn(true, true, true, false);
170168
given(resultSet.getString(1)).willReturn(dbResults[0], dbResults[1], dbResults[2]);
171169
StringQuery query = new StringQuery(dataSource, SELECT_FORENAME);
172-
query.setRowsExpected(3);
173170
String[] results = query.run();
174171
assertThat(results).isEqualTo(dbResults);
175172
verify(connection).prepareStatement(SELECT_FORENAME);

0 commit comments

Comments
 (0)