提交 b62652ac 编写于 作者: J Juergen Hoeller

Reduced "getParameterType call not supported" log message to single line

Issue: SPR-10185
(cherry picked from commit 41f041e6)
上级 fce02d94
...@@ -120,8 +120,7 @@ public abstract class StatementCreatorUtils { ...@@ -120,8 +120,7 @@ public abstract class StatementCreatorUtils {
* @param inValue the value to set * @param inValue the value to set
* @throws SQLException if thrown by PreparedStatement methods * @throws SQLException if thrown by PreparedStatement methods
*/ */
public static void setParameterValue( public static void setParameterValue(PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
PreparedStatement ps, int paramIndex, SqlParameter param, Object inValue)
throws SQLException { throws SQLException {
setParameterValueInternal(ps, paramIndex, param.getSqlType(), param.getTypeName(), param.getScale(), inValue); setParameterValueInternal(ps, paramIndex, param.getSqlType(), param.getTypeName(), param.getScale(), inValue);
...@@ -137,8 +136,7 @@ public abstract class StatementCreatorUtils { ...@@ -137,8 +136,7 @@ public abstract class StatementCreatorUtils {
* @throws SQLException if thrown by PreparedStatement methods * @throws SQLException if thrown by PreparedStatement methods
* @see SqlTypeValue * @see SqlTypeValue
*/ */
public static void setParameterValue( public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
PreparedStatement ps, int paramIndex, int sqlType, Object inValue)
throws SQLException { throws SQLException {
setParameterValueInternal(ps, paramIndex, sqlType, null, null, inValue); setParameterValueInternal(ps, paramIndex, sqlType, null, null, inValue);
...@@ -156,9 +154,8 @@ public abstract class StatementCreatorUtils { ...@@ -156,9 +154,8 @@ public abstract class StatementCreatorUtils {
* @throws SQLException if thrown by PreparedStatement methods * @throws SQLException if thrown by PreparedStatement methods
* @see SqlTypeValue * @see SqlTypeValue
*/ */
public static void setParameterValue( public static void setParameterValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName,
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Object inValue) Object inValue) throws SQLException {
throws SQLException {
setParameterValueInternal(ps, paramIndex, sqlType, typeName, null, inValue); setParameterValueInternal(ps, paramIndex, sqlType, typeName, null, inValue);
} }
...@@ -177,9 +174,8 @@ public abstract class StatementCreatorUtils { ...@@ -177,9 +174,8 @@ public abstract class StatementCreatorUtils {
* @throws SQLException if thrown by PreparedStatement methods * @throws SQLException if thrown by PreparedStatement methods
* @see SqlTypeValue * @see SqlTypeValue
*/ */
private static void setParameterValueInternal( private static void setParameterValueInternal(PreparedStatement ps, int paramIndex, int sqlType,
PreparedStatement ps, int paramIndex, int sqlType, String typeName, Integer scale, Object inValue) String typeName, Integer scale, Object inValue) throws SQLException {
throws SQLException {
String typeNameToUse = typeName; String typeNameToUse = typeName;
int sqlTypeToUse = sqlType; int sqlTypeToUse = sqlType;
...@@ -190,8 +186,7 @@ public abstract class StatementCreatorUtils { ...@@ -190,8 +186,7 @@ public abstract class StatementCreatorUtils {
SqlParameterValue parameterValue = (SqlParameterValue) inValue; SqlParameterValue parameterValue = (SqlParameterValue) inValue;
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Overriding type info with runtime info from SqlParameterValue: column index " + paramIndex + logger.debug("Overriding type info with runtime info from SqlParameterValue: column index " + paramIndex +
", SQL type " + parameterValue.getSqlType() + ", SQL type " + parameterValue.getSqlType() + ", type name " + parameterValue.getTypeName());
", Type name " + parameterValue.getTypeName());
} }
if (parameterValue.getSqlType() != SqlTypeValue.TYPE_UNKNOWN) { if (parameterValue.getSqlType() != SqlTypeValue.TYPE_UNKNOWN) {
sqlTypeToUse = parameterValue.getSqlType(); sqlTypeToUse = parameterValue.getSqlType();
...@@ -221,9 +216,7 @@ public abstract class StatementCreatorUtils { ...@@ -221,9 +216,7 @@ public abstract class StatementCreatorUtils {
* Set the specified PreparedStatement parameter to null, * Set the specified PreparedStatement parameter to null,
* respecting database-specific peculiarities. * respecting database-specific peculiarities.
*/ */
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException {
throws SQLException {
if (sqlType == SqlTypeValue.TYPE_UNKNOWN) { if (sqlType == SqlTypeValue.TYPE_UNKNOWN) {
boolean useSetObject = false; boolean useSetObject = false;
sqlType = Types.NULL; sqlType = Types.NULL;
...@@ -231,9 +224,10 @@ public abstract class StatementCreatorUtils { ...@@ -231,9 +224,10 @@ public abstract class StatementCreatorUtils {
sqlType = ps.getParameterMetaData().getParameterType(paramIndex); sqlType = ps.getParameterMetaData().getParameterType(paramIndex);
} }
catch (Throwable ex) { catch (Throwable ex) {
logger.debug("JDBC 3.0 getParameterType call not supported", ex); if (logger.isDebugEnabled()) {
// JDBC driver not compliant with JDBC 3.0 logger.debug("JDBC 3.0 getParameterType call not supported - using fallback method instead: " + ex);
// -> proceed with database-specific checks }
// JDBC driver not compliant with JDBC 3.0 -> proceed with database-specific checks
try { try {
DatabaseMetaData dbmd = ps.getConnection().getMetaData(); DatabaseMetaData dbmd = ps.getConnection().getMetaData();
String databaseProductName = dbmd.getDatabaseProductName(); String databaseProductName = dbmd.getDatabaseProductName();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册