[CONJ-179] Statement.getMoreResults() returns wrong value Created: 2015-08-11  Updated: 2017-09-27  Resolved: 2015-11-24

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.2.0
Fix Version/s: 1.3.3

Type: Bug Priority: Major
Reporter: Geert Konijnendijk Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

Debian Jessie, Oracle JDK 8u51, MySQL 5.5.44-0+deb8u1


Issue Links:
Relates
relates to CONJ-532 Statement.getMoreResults() incorrect ... Closed

 Description   

When executing the code below the getMoreResults() method returns true instead of false, while the getResultSet() method returns null and the second call of the getUpdateCount() method returns 1. The used table test has two columns, one "integer" and one "text".

Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/database?allowMultiQueries=true");
Statement stmt = connection.createStatement();
stmt.execute("insert into test values (1, 'one'); insert into test values (2, 'two');");
int firstCount = stmt.getUpdateCount();
boolean more = stmt.getMoreResults();
int secondCount = stmt.getUpdateCount();
ResultSet secondSet = stmt.getResultSet();

So in this case firstCount=1, more=true, secondCount=1 and secondSet=null. However, more=false is the correct result. When run using the MySQL Connector/J driver getMoreResults behaves as expected.



 Comments   
Comment by Diego Dupin [ 2015-11-24 ]

you're right. merging https://github.com/MariaDB/mariadb-connector-j/pull/36

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