mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for issue 796
This commit is contained in:
@@ -37,6 +37,7 @@ import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.druid.proxy.jdbc.JdbcParameter.TYPE;
|
||||
@@ -50,6 +51,7 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
protected final String sql;
|
||||
private JdbcParameter[] parameters = new JdbcParameter[16];
|
||||
private int parametersSize = 0;
|
||||
private Map<Integer, JdbcParameter> paramMap = null;
|
||||
|
||||
public PreparedStatementProxyImpl(ConnectionProxy connection, PreparedStatement statement, String sql, long id){
|
||||
super(connection, statement, id);
|
||||
@@ -58,7 +60,14 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
}
|
||||
|
||||
public Map<Integer, JdbcParameter> getParameters() {
|
||||
return null;
|
||||
if (paramMap == null) {
|
||||
paramMap = new HashMap<Integer, JdbcParameter>(parametersSize);
|
||||
for (int i = 0; i < parametersSize; ++i) {
|
||||
paramMap.put(i, parameters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
void setParameter(int jdbcIndex, JdbcParameter parameter) {
|
||||
@@ -71,6 +80,10 @@ public class PreparedStatementProxyImpl extends StatementProxyImpl implements Pr
|
||||
parameters = Arrays.copyOf(parameters, parametersSize + 16);
|
||||
}
|
||||
parameters[index] = parameter;
|
||||
|
||||
if (paramMap != null) {
|
||||
paramMap = null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getParametersSize() {
|
||||
|
||||
Reference in New Issue
Block a user