Merge pull request #1586 from jmax01/master
Correctly handle NVARCHAR, LONGNVARCHAR and NCLOBs Issue: SPR-16154
This commit is contained in:
commit
a37fce854f
|
|
@ -295,10 +295,12 @@ public abstract class StatementCreatorUtils {
|
||||||
else if (inValue instanceof SqlValue) {
|
else if (inValue instanceof SqlValue) {
|
||||||
((SqlValue) inValue).setValue(ps, paramIndex);
|
((SqlValue) inValue).setValue(ps, paramIndex);
|
||||||
}
|
}
|
||||||
else if (sqlType == Types.VARCHAR || sqlType == Types.NVARCHAR ||
|
else if (sqlType == Types.VARCHAR || sqlType == Types.LONGVARCHAR ) {
|
||||||
sqlType == Types.LONGVARCHAR || sqlType == Types.LONGNVARCHAR) {
|
|
||||||
ps.setString(paramIndex, inValue.toString());
|
ps.setString(paramIndex, inValue.toString());
|
||||||
}
|
}
|
||||||
|
else if (sqlType == Types.NVARCHAR || sqlType == Types.LONGNVARCHAR) {
|
||||||
|
ps.setNString(paramIndex, inValue.toString());
|
||||||
|
}
|
||||||
else if ((sqlType == Types.CLOB || sqlType == Types.NCLOB) && isStringValue(inValue.getClass())) {
|
else if ((sqlType == Types.CLOB || sqlType == Types.NCLOB) && isStringValue(inValue.getClass())) {
|
||||||
String strVal = inValue.toString();
|
String strVal = inValue.toString();
|
||||||
if (strVal.length() > 4000) {
|
if (strVal.length() > 4000) {
|
||||||
|
|
@ -312,8 +314,15 @@ public abstract class StatementCreatorUtils {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Fallback: regular setString binding
|
else {
|
||||||
ps.setString(paramIndex, strVal);
|
// Fallback: setString or setNString binding
|
||||||
|
if (sqlType == Types.NCLOB) {
|
||||||
|
ps.setNString(paramIndex, strVal);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ps.setString(paramIndex, strVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) {
|
else if (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) {
|
||||||
if (inValue instanceof BigDecimal) {
|
if (inValue instanceof BigDecimal) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue