Commit 17c5cbce authored by Quxl's avatar Quxl

x

parent a9e5ba27
...@@ -552,7 +552,29 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -552,7 +552,29 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
}); });
} }
public List<Object> exec(final String sql, Map<Integer, Object> out, final Object... args) { public static class OutParameter {
private final int index;
private final int type;
private Object value;
public OutParameter(int index, int type) {
this.index = index;
this.type = type;
}
public int getIndex() {
return index;
}
public int getType() {
return type;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}
public List<Object> exec(final String sql, List<OutParameter> outs, final Object... args) {
showSql(sql, args); showSql(sql, args);
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 {
...@@ -560,9 +582,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -560,9 +582,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
for(int i = 0; i < args.length; i++) { for(int i = 0; i < args.length; i++) {
cs.setObject(i+1, args[i]); cs.setObject(i+1, args[i]);
} }
if(out != null && out.size() > 0) { if(outs != null && outs.size() > 0) {
for(Integer key : out.keySet()) { for(OutParameter out : outs) {
cs.registerOutParameter(key, (Integer)out.get(key)); cs.registerOutParameter(out.getIndex(), out.getType());
} }
} }
return cs; return cs;
...@@ -585,9 +607,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -585,9 +607,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
cs.getMoreResults(); cs.getMoreResults();
} }
} }
if(out != null && out.size() > 0) { if(outs != null && outs.size() > 0) {
for(Integer key: out.keySet()) { for(OutParameter out : outs) {
out.put(key, cs.getObject((Integer)key)); out.setValue(cs.getObject(out.getIndex()));
} }
} }
return datas; return datas;
......
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