|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2010 the original author or authors. |
|
|
|
* Copyright 2002-2011 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -33,6 +33,7 @@ import org.springframework.jdbc.core.ResultSetExtractor; |
|
|
|
import org.springframework.jdbc.core.RowCallbackHandler; |
|
|
|
import org.springframework.jdbc.core.RowCallbackHandler; |
|
|
|
import org.springframework.jdbc.core.RowMapper; |
|
|
|
import org.springframework.jdbc.core.RowMapper; |
|
|
|
import org.springframework.jdbc.core.SingleColumnRowMapper; |
|
|
|
import org.springframework.jdbc.core.SingleColumnRowMapper; |
|
|
|
|
|
|
|
import org.springframework.jdbc.core.SqlParameter; |
|
|
|
import org.springframework.jdbc.core.SqlRowSetResultSetExtractor; |
|
|
|
import org.springframework.jdbc.core.SqlRowSetResultSetExtractor; |
|
|
|
import org.springframework.jdbc.support.KeyHolder; |
|
|
|
import org.springframework.jdbc.support.KeyHolder; |
|
|
|
import org.springframework.jdbc.support.rowset.SqlRowSet; |
|
|
|
import org.springframework.jdbc.support.rowset.SqlRowSet; |
|
|
|
@ -276,8 +277,8 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations |
|
|
|
ParsedSql parsedSql = getParsedSql(sql); |
|
|
|
ParsedSql parsedSql = getParsedSql(sql); |
|
|
|
String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); |
|
|
|
String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); |
|
|
|
Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null); |
|
|
|
Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null); |
|
|
|
int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource); |
|
|
|
List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql, paramSource); |
|
|
|
PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes); |
|
|
|
PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, declaredParameters); |
|
|
|
if (keyColumnNames != null) { |
|
|
|
if (keyColumnNames != null) { |
|
|
|
pscf.setGeneratedKeysColumnNames(keyColumnNames); |
|
|
|
pscf.setGeneratedKeysColumnNames(keyColumnNames); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -313,8 +314,8 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations |
|
|
|
ParsedSql parsedSql = getParsedSql(sql); |
|
|
|
ParsedSql parsedSql = getParsedSql(sql); |
|
|
|
String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); |
|
|
|
String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource); |
|
|
|
Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null); |
|
|
|
Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null); |
|
|
|
int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource); |
|
|
|
List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql, paramSource); |
|
|
|
PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes); |
|
|
|
PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, declaredParameters); |
|
|
|
return pscf.newPreparedStatementCreator(params); |
|
|
|
return pscf.newPreparedStatementCreator(params); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|