zoukankan      html  css  js  c++  java
  • Spring2.5.6 的一段源码疑似bug

    在AbstractJdbcInsert类中的方法:

    	private void setParameterValues(PreparedStatement preparedStatement, List<Object> values, int[] columnTypes)
    			throws SQLException {
    		int colIndex = 0;
    		for (Object value : values) {
    			colIndex++;
    			if (columnTypes == null || colIndex < columnTypes.length) {
    				StatementCreatorUtils.setParameterValue(preparedStatement, colIndex, SqlTypeValue.TYPE_UNKNOWN, value);
    			}
    			else {
    				StatementCreatorUtils.setParameterValue(preparedStatement, colIndex, columnTypes[colIndex - 1], value);
    			}
    		}
    	}
    看这里 if (columnTypes == null || colIndex < columnTypes.length) 
    为何colIndex < columnTypes.length时要使用SqlTypeValue.TYPE_UNKNOWN呢,应该这样的吧:
    if (columnTypes == null || colIndex > columnTypes.length) {
    				StatementCreatorUtils.setParameterValue(preparedStatement, colIndex, SqlTypeValue.TYPE_UNKNOWN, value);
    			}
    			else {
    				StatementCreatorUtils.setParameterValue(preparedStatement, colIndex, columnTypes[colIndex - 1], value);
    }
  • 相关阅读:
    vim 命令详解
    vim基础命令
    JSP取得绝对路径
    sigar开发(java)
    HDU-5273
    HDU-1671
    HDU-1251
    POJ-1743
    POJ-2774
    hihocoder 1145 : 幻想乡的日常
  • 原文地址:https://www.cnblogs.com/cwjcsu/p/8433115.html
Copyright © 2011-2022 走看看