Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.5.4
-
None
-
AWS Aurora MySQL 5.6
Java 1.8
spring jdbc 4.2.5
Description
I am trying to upgrade maraidb-java-client from 1.4.6 to 1.5.4 to support cluster endpoint but I am not able to upgrade it because calling 'execute(SqlParameterSource)' method in SimpleJdbcCall won't return result as like 1.4.6 does.
Here is sample client code that trying to retrieve data from MySSQL stored procedure;
public List<Renew> findById(Integer id) {
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate)
.withProcedureName("RenewGet")
.withoutProcedureColumnMetaDataAccess()
.declareParameters(
new SqlParameter("idIn", Types.INTEGER))
.returningResultSet("items", new RenewMapper());
SqlParameterSource sqlParameterSource = new MapSqlParameterSource().addValue("id", id);
Map<String, Object> out = null;
try
finally {}
return (List<Renew>) out.get("items");
}
It expects output return 'items' that containing result but failed to return data. It is because getUpdateCount() in MariaDBStatement class returns 0 instead of -1 in 1.5.4, so JdbcTemplate won't put the result into output (returnedResult).
version 1.5.4;
public int getUpdateCount() throws SQLException {
if (executionResult == null)
if (executionResult.isSingleExecutionResult()) { return (int) ((SingleExecutionResult) executionResult).getAffectedRows(); } else { return ((MultiExecutionResult) executionResult).getFirstAffectedRows(); }
}
version 1.4.6
public int getUpdateCount() throws SQLException {
if (executionResult == null || executionResult.getResult() != null) { return -1; /* Result comes from SELECT , or there are no more results */ }
if (executionResult instanceof SingleExecutionResult)
{ // same as above }}