From: Juergen H. <jho...@us...> - 2006-04-20 09:54:47
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21313/src/org/springframework/jdbc/core Modified Files: PreparedStatementCreatorFactory.java Log Message: generatedKeyColumnNames is sufficient (no returnGeneratedKeys necessary), only expand Collection for SQL type other than ARRAY Index: PreparedStatementCreatorFactory.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PreparedStatementCreatorFactory.java 8 Apr 2006 20:53:16 -0000 1.28 --- PreparedStatementCreatorFactory.java 20 Apr 2006 09:54:45 -0000 1.29 *************** *** 21,24 **** --- 21,25 ---- import java.sql.ResultSet; import java.sql.SQLException; + import java.sql.Types; import java.util.Arrays; import java.util.Collection; *************** *** 157,161 **** */ public PreparedStatementCreator newPreparedStatementCreator(Object[] params) { ! return new PreparedStatementCreatorImpl((params != null) ? Arrays.asList(params) : Collections.EMPTY_LIST); } --- 158,162 ---- */ public PreparedStatementCreator newPreparedStatementCreator(Object[] params) { ! return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.EMPTY_LIST); } *************** *** 210,220 **** sqlToUse = sql; } ! if (returnGeneratedKeys) { try { ! if (generatedKeysColumnNames == null) { ! ps = con.prepareStatement(sqlToUse, PreparedStatement.RETURN_GENERATED_KEYS); } else { ! ps = con.prepareStatement(sqlToUse, generatedKeysColumnNames); } } --- 211,221 ---- sqlToUse = sql; } ! if (generatedKeysColumnNames != null || returnGeneratedKeys) { try { ! if (generatedKeysColumnNames != null) { ! ps = con.prepareStatement(sqlToUse, generatedKeysColumnNames); } else { ! ps = con.prepareStatement(sqlToUse, PreparedStatement.RETURN_GENERATED_KEYS); } } *************** *** 249,253 **** SqlParameter declaredParameter = (SqlParameter) declaredParameters.get(i); Object in = this.parameters.get(i); ! if (in instanceof Collection) { Collection entries = (Collection) in; for (Iterator it = entries.iterator(); it.hasNext();) { --- 250,254 ---- SqlParameter declaredParameter = (SqlParameter) declaredParameters.get(i); Object in = this.parameters.get(i); ! if (in instanceof Collection && declaredParameter.getSqlType() != Types.ARRAY) { Collection entries = (Collection) in; for (Iterator it = entries.iterator(); it.hasNext();) { |