Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.7, 1.1.8, 1.1.9, 1.2.0
-
None
Description
If setting a CHAR(1) database field, using Java char's or java.lang.Character, setObject fails with:
Caused by: java.sql.SQLException: Could not set parameter in setObject, could not convert: class java.lang.Character to 1
|
at org.mariadb.jdbc.internal.SQLExceptionMapper.getSQLException(SQLExceptionMapper.java:161)
|
So where,
setObject(final int parameterIndex, final Object x, final int targetSqlType)
|
Object x is of type java.lang.Character
and targetSqlType is 1 (java.sql.Types.CHAR)
This can be fixed by adding a check for Character type, in setObject:
else if (x instanceof Character) {
|
setString(parameterIndex, x.toString());
|
}
|
Attachments
Issue Links
- is duplicated by
-
CONJ-820 MySQLPreparedStatement.setObject cannot handle java.lang.Character type
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Affects Version/s | 1.1.9 [ 16400 ] | |
Affects Version/s | 1.1.8 [ 15700 ] | |
Affects Version/s | 1.1.7 [ 15300 ] |
Fix Version/s | 1.3.0 [ 19602 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Component/s | Other [ 12201 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 71131 ] | MariaDB v4 [ 134794 ] |
corrected in 1.3.0.
test case added.