Commit 17c5cbce authored by Quxl's avatar Quxl

x

parent a9e5ba27
......@@ -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);
return super.execute(new CallableStatementCreator() {
public CallableStatement createCallableStatement(final Connection con) throws SQLException {
......@@ -560,9 +582,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
for(int i = 0; i < args.length; i++) {
cs.setObject(i+1, args[i]);
}
if(out != null && out.size() > 0) {
for(Integer key : out.keySet()) {
cs.registerOutParameter(key, (Integer)out.get(key));
if(outs != null && outs.size() > 0) {
for(OutParameter out : outs) {
cs.registerOutParameter(out.getIndex(), out.getType());
}
}
return cs;
......@@ -585,9 +607,9 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
cs.getMoreResults();
}
}
if(out != null && out.size() > 0) {
for(Integer key: out.keySet()) {
out.put(key, cs.getObject((Integer)key));
if(outs != null && outs.size() > 0) {
for(OutParameter out : outs) {
out.setValue(cs.getObject(out.getIndex()));
}
}
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