Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.1.0
Description
org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet method wasNull can't change once lastGetWasNull is set to true
So this simple code taken from MyBatis always returns null values after that lastGetWasNull is set to true.
This is caused from the org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet wasNull implementation method that returns always true after the first read that sets lastGetWasNull = true, for example reading a LocalDateTime "0000-00-00 00:00:00" from the db.
That makes the read of all the following column values null.
@Override
|
public T getResult(ResultSet rs, String columnName) throws SQLException { |
T result;
|
try { |
result = getNullableResult(rs, columnName);
|
} catch (Exception e) { |
throw new ResultMapException("Error attempting to get column '" + columnName + "' from result set. Cause: " + e, e); |
}
|
if (rs.wasNull()) { |
return null; |
} else { |
return result; |
}
|
}
|
The documentation of the ResultSet interface method wasNull tells:
"true if the last column value read was SQL NULL and false otherwise"
so I think that that value should be reset to false in some way.