[CONJ-1126] setting fetchSize directly on a ResultSet object does not reflect the expected change Created: 2023-11-18  Updated: 2023-11-21  Resolved: 2023-11-21

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 3.3.0
Fix Version/s: 3.3.1

Type: Bug Priority: Major
Reporter: Wenqian Deng Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Setting the fetch size directly on a ResultSet object does not reflect the expected change, whereas setting it on the Statement object does.
However, if the fetch size is first set on the Statement and then modified on the ResultSet, the change is successfully reflected, which I think is confusing.

@Test
public void test() throws SQLException {
        Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;
        con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test24", "user", "password");
        stmt = con.createStatement();
        //stmt.setFetchSize(20);
        rs = stmt.executeQuery("SELECT 1");
        System.out.println(rs.getFetchSize()); // 0
        rs.setFetchSize(40);
        System.out.println(rs.getFetchSize()); // 0
}

In the provided test case, the fetch size is initially attempted to be set directly on a ResultSet object using rs.setFetchSize(40), but querying rs.getFetchSize() afterwards still returns 0, indicating that the fetch size was not updated. In contrast, setting the fetch size on the Statement object using stmt.setFetchSize(20) works as expected. Furthermore, if the fetch size is first set on the Statement and then modified on the ResultSet, the new value is successfully applied.



 Comments   
Comment by Diego Dupin [ 2023-11-21 ]

Correction done

Until release, correction is available using through:

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
	<name>Sonatype Nexus Snapshots</name>
	<url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>3.3.1-SNAPSHOT</version>
    </dependency>
</dependencies>

Generated at Thu Feb 08 03:20:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.