Modified:
branches/branch_3_1/connector-j/CHANGES
branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
Log:
CallableStatement.clearParameters() now clears resources associated
with INOUT/OUTPUT parameters as well as INPUT parameters.
Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES 2005-08-24 00:05:55 UTC (rev 4134)
+++ branches/branch_3_1/connector-j/CHANGES 2005-08-24 20:14:50 UTC (rev 4135)
@@ -120,6 +120,9 @@
PacketTooBigExceptions when "max_allowed_packet" is similar in size
to the default "sendBlobChunkSize" which is 1M.
+ - CallableStatement.clearParameters() now clears resources associated
+ with INOUT/OUTPUT parameters as well as INPUT parameters.
+
06-23-05 - Version 3.1.10-stable
- Fixed connecting without a database specified raised an exception
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2005-08-24
00:05:55 UTC (rev 4134)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/CallableStatement.java 2005-08-24
20:14:50 UTC (rev 4135)
@@ -64,18 +64,18 @@
int index;
+ int inOutModifier;
+
boolean isIn;
boolean isOut;
+ int jdbcType;
+ short nullability;
String paramName;
-
- int jdbcType;
- String typeName;
- int precision;
+ int precision;
int scale;
- short nullability;
- int inOutModifier;
+ String typeName;
CallableStatementParam(String name, int idx, boolean in,
boolean out, int jdbcType, String typeName,
@@ -182,6 +182,18 @@
}
}
+ protected void checkBounds(int paramIndex) throws SQLException {
+ int localParamIndex = paramIndex - 1;
+
+ if ((paramIndex < 0)
+ || (localParamIndex >= this.numParameters)) {
+ throw new SQLException(
+ Messages.getString("CallableStatement.11") + paramIndex //$NON-NLS-1$
+ + Messages.getString("CallableStatement.12") + numParameters //$NON-NLS-1$
+ + Messages.getString("CallableStatement.13"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -200,28 +212,31 @@
return (CallableStatementParam) this.parameterMap.get(name);
}
- Iterator iterator() {
- return this.parameterList.iterator();
+ public String getParameterClassName(int arg0) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
}
- int numberOfParameters() {
- return this.numParameters;
- }
-
public int getParameterCount() throws SQLException {
return this.parameterList.size();
}
- public int isNullable(int arg0) throws SQLException {
+ public int getParameterMode(int arg0) throws SQLException {
checkBounds(arg0);
- return getParameter(arg0 - 1).nullability;
+ return getParameter(arg0 - 1).inOutModifier;
}
- public boolean isSigned(int arg0) throws SQLException {
+ public int getParameterType(int arg0) throws SQLException {
checkBounds(arg0);
+
+ return getParameter(arg0 - 1).jdbcType;
+ }
- return false;
+ public String getParameterTypeName(int arg0) throws SQLException {
+ checkBounds(arg0);
+
+ return getParameter(arg0 - 1).typeName;
}
public int getPrecision(int arg0) throws SQLException {
@@ -236,39 +251,24 @@
return getParameter(arg0 - 1).scale;
}
- public int getParameterType(int arg0) throws SQLException {
+ public int isNullable(int arg0) throws SQLException {
checkBounds(arg0);
- return getParameter(arg0 - 1).jdbcType;
+ return getParameter(arg0 - 1).nullability;
}
- public String getParameterTypeName(int arg0) throws SQLException {
+ public boolean isSigned(int arg0) throws SQLException {
checkBounds(arg0);
-
- return getParameter(arg0 - 1).typeName;
- }
- public String getParameterClassName(int arg0) throws SQLException {
- // TODO Auto-generated method stub
- return null;
+ return false;
}
- public int getParameterMode(int arg0) throws SQLException {
- checkBounds(arg0);
-
- return getParameter(arg0 - 1).inOutModifier;
+ Iterator iterator() {
+ return this.parameterList.iterator();
}
- protected void checkBounds(int paramIndex) throws SQLException {
- int localParamIndex = paramIndex - 1;
-
- if ((paramIndex < 0)
- || (localParamIndex >= this.numParameters)) {
- throw new SQLException(
- Messages.getString("CallableStatement.11") + paramIndex //$NON-NLS-1$
- + Messages.getString("CallableStatement.12") + numParameters //$NON-NLS-1$
- + Messages.getString("CallableStatement.13"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
- }
+ int numberOfParameters() {
+ return this.numParameters;
}
}
@@ -450,6 +450,18 @@
}
}
+ public synchronized void clearParameters() throws SQLException {
+ super.clearParameters();
+
+ try {
+ if (this.outputParameterResults != null) {
+ this.outputParameterResults.close();
+ }
+ } finally {
+ this.outputParameterResults = null;
+ }
+ }
+
private void determineParameterTypes() throws SQLException {
java.sql.ResultSet paramTypesRs = null;
| Thread |
|---|
| • Connector/J commit: r4135 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc | mmatthews | 24 Aug |