Commit 155976d8 authored by Quxl's avatar Quxl

x

parent 9a238861
...@@ -543,15 +543,16 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -543,15 +543,16 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
}); });
} }
public List<Object> exec(final String sql, final Object... args) { public List<Object> exec(final String sql, Object... args) {
showSql(sql, args); final Object[] argsArray = this.toArray(args);
showSql(sql, argsArray);
Map<Integer, OutParameter> out = new HashMap<Integer, OutParameter>(); Map<Integer, OutParameter> out = new HashMap<Integer, OutParameter>();
return super.execute(new CallableStatementCreator() { return super.execute(new CallableStatementCreator() {
public CallableStatement createCallableStatement(final Connection con) throws SQLException { public CallableStatement createCallableStatement(final Connection con) throws SQLException {
final CallableStatement cs = con.prepareCall(sql); final CallableStatement cs = con.prepareCall(sql);
for(int i = 0; i < args.length; i++) { for(int i = 0; i < argsArray.length; i++) {
Integer index = i + 1; Integer index = i + 1;
Object arg = args[i]; Object arg = argsArray[i];
if(arg != null && arg instanceof OutParameter) { if(arg != null && arg instanceof OutParameter) {
OutParameter outArg = (OutParameter)arg; OutParameter outArg = (OutParameter)arg;
outArg.setValue(null); outArg.setValue(null);
...@@ -697,5 +698,12 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -697,5 +698,12 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
} }
} }
private Object[] toArray(Object... args) {
while(args != null && args.length == 1 && args[0] != null && args[0] instanceof Object[]) {
args = (Object[])args[0];
}
return args;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment