db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davi...@apache.org
Subject svn commit: r371561 [6/11] - in /db/derby/code/trunk/java: client/org/apache/derby/client/ client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ client/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/master/DerbyNe...
Date Mon, 23 Jan 2006 15:58:53 GMT
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java?rev=371561&r1=371560&r2=371561&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java Mon
Jan 23 07:58:34 2006
@@ -25,6 +25,81 @@
     // the middle of parsing an Sqlca reply.
     // Without this, if e.getMessage() fails, we would have infinite recursion
     // when TRACE_DIAGNOSTICS is on  because tracing occurs within the exception constructor.
+    static public void printTrace(SqlException e,
+                                  java.io.PrintWriter printWriter,
+                                  String messageHeader,
+                                  boolean returnTokensOnly) {
+        String header;
+        synchronized (printWriter) {
+            while (e != null) {
+                header = messageHeader + "[" + "SQLException@" + Integer.toHexString(e.hashCode())
+ "]";
+                printWriter.println(header + " java.sql.SQLException");
+
+                java.lang.Throwable throwable = null;
+                try {
+                    throwable = ((Diagnosable) e).getThrowable();
+                } catch (java.lang.NoSuchMethodError doNothing) {
+                }
+                if (throwable != null) {
+                    printTrace(throwable, printWriter, header);
+                }
+                Sqlca sqlca = ((Diagnosable) e).getSqlca();
+                if (sqlca != null) {
+                    printTrace(sqlca, printWriter, header);
+                    // JDK stack trace calls e.getMessage(), so we must set some state on
the sqlca that says return tokens only.
+                    ((Sqlca) sqlca).returnTokensOnlyInMessageText(returnTokensOnly);
+                }
+
+                printWriter.println(header + " SQL state  = " + e.getSQLState());
+                printWriter.println(header + " Error code = " + String.valueOf(e.getErrorCode()));
+                if (((Diagnosable) e).getSqlca() == null) { // Too much has changed, so escape
out here.
+                    printWriter.println(header + " Message    = " + e.getMessage());
+                } else { // This is server-side error.
+                    sqlca = ((Diagnosable) e).getSqlca();
+                    if (returnTokensOnly) {
+                        // print message tokens directly.
+                        printWriter.println(header + " Tokens     = " + sqlca.getSqlErrmc());
// a string containing error tokens only
+                    } else {
+                        // Try to get message text from server.
+                        String message = e.getMessage();
+                        if (!sqlca.messageTextRetrievedContainsTokensOnly_) { // got the
message text.
+                            printWriter.println(header + " Message    = " + message);
+                        } else { // got only message tokens.
+                            java.sql.SQLException mysteryException = sqlca.exceptionThrownOnStoredProcInvocation_;
+                            if (mysteryException != null &&
+                                    (mysteryException.getErrorCode() == -440 || mysteryException.getErrorCode()
== -444)) {
+                                printWriter.println(header + " Unable to obtain message text
from server." +
+                                        " Only message tokens are available." +
+                                        " The stored procedure SYSIBM.SQLCAMESSAGE is not
installed on server." +
+                                        " Contact your DBA.");
+                            } else {
+                                printWriter.println(header + " Error occurred while trying
to obtain message text from server. " +
+                                        "Only message tokens are available.");
+                            }
+                            printWriter.println(header + " Tokens     = " + message);
+                        }
+                    }
+                }
+
+                printWriter.println(header + " Stack trace follows");
+                e.printStackTrace(printWriter);
+
+                if (e instanceof Diagnosable) {
+                    sqlca = (Sqlca) ((Diagnosable) e).getSqlca();
+                    if (sqlca != null) {
+                        // JDK stack trace calls e.getMessage(), now that it is finished,
+                        // we can reset the state on the sqlca that says return tokens only.
+                        sqlca.returnTokensOnlyInMessageText(false);
+                    }
+                }
+
+                e = e.getNextException();
+            }
+
+            printWriter.flush();
+        }
+    }
+
     static public void printTrace(java.sql.SQLException e,
                                   java.io.PrintWriter printWriter,
                                   String messageHeader,
@@ -46,57 +121,9 @@
                     printWriter.println(header + " java.sql.SQLException");
                 }
 
-                if (e instanceof Diagnosable) {
-                    java.lang.Throwable throwable = null;
-                    try {
-                        throwable = ((Diagnosable) e).getThrowable();
-                    } catch (java.lang.NoSuchMethodError doNothing) {
-                    }
-                    if (throwable != null) {
-                        printTrace(throwable, printWriter, header);
-                    }
-                    Sqlca sqlca = ((Diagnosable) e).getSqlca();
-                    if (sqlca != null) {
-                        printTrace(sqlca, printWriter, header);
-                        // JDK stack trace calls e.getMessage(), so we must set some state
on the sqlca that says return tokens only.
-                        ((Sqlca) sqlca).returnTokensOnlyInMessageText(returnTokensOnly);
-                    }
-                }
-
                 printWriter.println(header + " SQL state  = " + e.getSQLState());
                 printWriter.println(header + " Error code = " + String.valueOf(e.getErrorCode()));
-                if (!(e instanceof Diagnosable)) {
-                    printWriter.println(header + " Message    = " + e.getMessage());
-                } else {
-                    if (((Diagnosable) e).getSqlca() == null) { // Too much has changed,
so escape out here.
-                        printWriter.println(header + " Message    = " + e.getMessage());
-                    } else { // This is server-side error.
-                        Sqlca sqlca = (Sqlca) ((Diagnosable) e).getSqlca();
-                        if (returnTokensOnly) {
-                            // print message tokens directly.
-                            printWriter.println(header + " Tokens     = " + sqlca.getSqlErrmc());
// a string containing error tokens only
-                        } else {
-                            // Try to get message text from server.
-                            String message = e.getMessage();
-                            if (!sqlca.messageTextRetrievedContainsTokensOnly_) { // got
the message text.
-                                printWriter.println(header + " Message    = " + message);
-                            } else { // got only message tokens.
-                                java.sql.SQLException mysteryException = sqlca.exceptionThrownOnStoredProcInvocation_;
-                                if (mysteryException != null &&
-                                        (mysteryException.getErrorCode() == -440 || mysteryException.getErrorCode()
== -444)) {
-                                    printWriter.println(header + " Unable to obtain message
text from server." +
-                                            " Only message tokens are available." +
-                                            " The stored procedure SYSIBM.SQLCAMESSAGE is
not installed on server." +
-                                            " Contact your DBA.");
-                                } else {
-                                    printWriter.println(header + " Error occurred while trying
to obtain message text from server. " +
-                                            "Only message tokens are available.");
-                                }
-                                printWriter.println(header + " Tokens     = " + message);
-                            }
-                        }
-                    }
-                }
+                printWriter.println(header + " Message    = " + e.getMessage());
 
                 if (e instanceof java.sql.DataTruncation) {
                     printWriter.println(header + " Index         = " + ((java.sql.DataTruncation)
e).getIndex());
@@ -112,15 +139,6 @@
 
                 printWriter.println(header + " Stack trace follows");
                 e.printStackTrace(printWriter);
-
-                if (e instanceof Diagnosable) {
-                    Sqlca sqlca = (Sqlca) ((Diagnosable) e).getSqlca();
-                    if (sqlca != null) {
-                        // JDK stack trace calls e.getMessage(), now that it is finished,
-                        // we can reset the state on the sqlca that says return tokens only.
-                        sqlca.returnTokensOnlyInMessageText(false);
-                    }
-                }
 
                 e = e.getNextException();
             }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java?rev=371561&r1=371560&r2=371561&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogWriter.java Mon Jan 23 07:58:34
2006
@@ -20,6 +20,8 @@
 
 package org.apache.derby.client.am;
 
+import java.sql.SQLException;
+
 import org.apache.derby.jdbc.ClientDataSource;
 
 public class LogWriter {
@@ -827,6 +829,19 @@
 
     // ---------------------------tracing exceptions and warnings-----------------
 
+    public void traceDiagnosable(SqlException e) {
+        if (traceSuspended()) {
+            return;
+        }
+        if (!loggingEnabled(ClientDataSource.TRACE_DIAGNOSTICS)) {
+            return;
+        }
+        synchronized (printWriter_) {
+            dncprintln("BEGIN TRACE_DIAGNOSTICS");
+            ExceptionFormatter.printTrace(e, printWriter_, "[derby]", true); // true means
return tokens only
+            dncprintln("END TRACE_DIAGNOSTICS");
+        }
+    }
     public void traceDiagnosable(java.sql.SQLException e) {
         if (traceSuspended()) {
             return;
@@ -871,7 +886,7 @@
                 dncprintln(header, "Number of parameter columns: " + columnMetaData.getColumnCount());
                 traceColumnMetaData(header, columnMetaData);
                 dncprintln(header, "END TRACE_PARAMETER_META_DATA");
-            } catch (SqlException e) {
+            } catch (SQLException e) {
                 dncprintln(header, "Encountered an SQL exception while trying to trace parameter
meta data");
                 dncprintln(header, "END TRACE_PARAMETER_META_DATA");
             }
@@ -893,7 +908,7 @@
                 dncprintln(header, "Number of result set columns: " + columnMetaData.getColumnCount());
                 traceColumnMetaData(header, columnMetaData);
                 dncprintln(header, "END TRACE_RESULT_SET_META_DATA");
-            } catch (SqlException e) {
+            } catch (SQLException e) {
                 dncprintln(header, "Encountered an SQL exception while trying to trace result
set meta data");
                 dncprintln(header, "END TRACE_RESULT_SET_META_DATA");
             }
@@ -954,7 +969,7 @@
                 printWriter_.println(" }");
                 printWriter_.flush();
             }
-        } catch (SqlException e) {
+        } catch (SQLException e) {
             dncprintln(header, "Encountered an SQL exception while trying to trace column
meta data");
         }
     }
@@ -1023,31 +1038,32 @@
     // ---------------------- tracing connects -----------------------------------
 
     private void traceConnectsResetEntry(ClientDataSource dataSource) {
-        if (traceSuspended()) {
-            return;
-        }
         try {
+            if (traceSuspended()) {
+                return;
+            }
             traceConnectsResetEntry(dataSource.getServerName(),
                     dataSource.getPortNumber(),
                     dataSource.getDatabaseName(),
                     dataSource.getProperties());
-        } catch (java.sql.SQLException e) {
+        } catch ( SqlException se ) {
             dncprintln("Encountered an SQL exception while trying to trace connection reset
entry");
         }
     }
 
     private void traceConnectsEntry(ClientDataSource dataSource) {
-        if (traceSuspended()) {
-            return;
-        }
         try {
+            if (traceSuspended()) {
+                return;
+            }
             traceConnectsEntry(dataSource.getServerName(),
                     dataSource.getPortNumber(),
                     dataSource.getDatabaseName(),
                     dataSource.getProperties());
-        } catch (java.sql.SQLException e) {
+        } catch ( SqlException se ) {
             dncprintln("Encountered an SQL exception while trying to trace connection entry");
         }
+        
     }
 
     private void traceConnectsResetEntry(String server,

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java?rev=371561&r1=371560&r2=371561&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java Mon
Jan 23 07:58:34 2006
@@ -20,6 +20,8 @@
 
 package org.apache.derby.client.am;
 
+import java.sql.SQLException;
+
 
 // A simple delegation wrapper handle for a physical connection.
 // All methods are forwarded to the underlying physical connection except for close() and
isClosed().
@@ -37,7 +39,11 @@
                              org.apache.derby.client.ClientPooledConnection pooledConnection)
throws SqlException {
         physicalConnection_ = physicalConnection;
         pooledConnection_ = pooledConnection;
-        checkForNullPhysicalConnection();
+        try {
+            checkForNullPhysicalConnection();
+        } catch ( SQLException se ) {
+            throw new SqlException(se);
+        }
     }
 
     protected void finalize() throws java.lang.Throwable {
@@ -52,26 +58,33 @@
     // ------------------------ logical connection close -------------------------
     // All methods are simply forwarded to the physical connection, except for close() and
isClosed().
 
-    synchronized public void close() throws SqlException {
-        // we also need to loop thru all the logicalStatements and close them
-        if (physicalConnection_ == null) {
-            return;
-        }
-        if (physicalConnection_.agent_.loggingEnabled()) {
-            physicalConnection_.agent_.logWriter_.traceEntry(this, "close");
-        }
-
-        if (physicalConnection_.isClosed()) // connection is closed or has become stale
+    synchronized public void close() throws SQLException {
+        try
         {
-            pooledConnection_.trashConnection(new SqlException(null, "Connection is stale."));
-        } else {
-            physicalConnection_.closeForReuse();
-            if (!physicalConnection_.isGlobalPending_()) {
-                pooledConnection_.recycleConnection();
+            // we also need to loop thru all the logicalStatements and close them
+            if (physicalConnection_ == null) {
+                return;
+            }
+            if (physicalConnection_.agent_.loggingEnabled()) {
+                physicalConnection_.agent_.logWriter_.traceEntry(this, "close");
+            }
+
+            if (physicalConnection_.isClosed()) // connection is closed or has become stale
+            {
+                pooledConnection_.trashConnection(new SqlException(null, "Connection is stale."));
+            } else {
+                physicalConnection_.closeForReuse();
+                if (!physicalConnection_.isGlobalPending_()) {
+                    pooledConnection_.recycleConnection();
+                }
             }
+            physicalConnection_ = null;
+            pooledConnection_.nullLogicalConnection();
+        }
+        catch ( SqlException se )
+        {
+            throw se.getSQLException();
         }
-        physicalConnection_ = null;
-        pooledConnection_.nullLogicalConnection();
     }
 
     synchronized public void closeWithoutRecyclingToPool() throws SqlException {
@@ -92,7 +105,7 @@
         }
     }
 
-    public boolean isClosed() throws SqlException {
+    public boolean isClosed() throws SQLException {
         if (physicalConnection_ == null) {
             return true;
         }
@@ -104,200 +117,204 @@
     // this method doesn't wrap in the standard way, because it went out without a throws
clause.
     // Unlike all other LogicalConnection methods, if the physical connection is null, it
won't throw an exception, but will return false.
 
-    private void checkForNullPhysicalConnection() throws SqlException {
+    private void checkForNullPhysicalConnection() throws SQLException {
         if (physicalConnection_ == null) {
-            throw new SqlException(null, " Attempt to use a closed connection. ");
+            throw new SqlException(null, " Attempt to use a closed connection. ").getSQLException();
         }
     }
 
     // ---------------------- wrapped public entry points ------------------------
     // All methods are forwarded to the physical connection in a standard way
 
-    synchronized public java.sql.Statement createStatement() throws SqlException {
+    synchronized public java.sql.Statement createStatement() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.createStatement();
     }
 
-    synchronized public java.sql.PreparedStatement prepareStatement(String sql) throws SqlException
{
+    synchronized public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException
{
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql);
     }
 
     synchronized public PreparedStatement preparePositionedUpdateStatement(String sql, Section
querySection) throws SqlException {
-        checkForNullPhysicalConnection();
+        try {
+            checkForNullPhysicalConnection();
+        } catch ( SQLException se ) {
+            throw new SqlException(se);
+        }
         return physicalConnection_.preparePositionedUpdateStatement(sql, querySection);
     }
 
-    synchronized public java.sql.CallableStatement prepareCall(String sql) throws SqlException
{
+    synchronized public java.sql.CallableStatement prepareCall(String sql) throws SQLException
{
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareCall(sql);
     }
 
-    public String nativeSQL(String sql) throws SqlException {
+    public String nativeSQL(String sql) throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.nativeSQL(sql);
     }
 
-    synchronized public void setAutoCommit(boolean autoCommit) throws SqlException {
+    synchronized public void setAutoCommit(boolean autoCommit) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setAutoCommit(autoCommit);
     }
 
-    public boolean getAutoCommit() throws SqlException {
+    public boolean getAutoCommit() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getAutoCommit();
     }
 
-    synchronized public void commit() throws SqlException {
+    synchronized public void commit() throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.commit();
     }
 
-    synchronized public void rollback() throws SqlException {
+    synchronized public void rollback() throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.rollback();
     }
 
-    synchronized public void setTransactionIsolation(int level) throws SqlException {
+    synchronized public void setTransactionIsolation(int level) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setTransactionIsolation(level);
     }
 
-    public int getTransactionIsolation() throws SqlException {
+    public int getTransactionIsolation() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getTransactionIsolation();
     }
 
-    public java.sql.SQLWarning getWarnings() throws SqlException {
+    public java.sql.SQLWarning getWarnings() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getWarnings();
     }
 
-    synchronized public void clearWarnings() throws SqlException {
+    synchronized public void clearWarnings() throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.clearWarnings();
     }
 
-    public java.sql.DatabaseMetaData getMetaData() throws SqlException {
+    public java.sql.DatabaseMetaData getMetaData() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getMetaData();
     }
 
-    synchronized public void setReadOnly(boolean readOnly) throws SqlException {
+    synchronized public void setReadOnly(boolean readOnly) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setReadOnly(readOnly);
     }
 
-    public boolean isReadOnly() throws SqlException {
+    public boolean isReadOnly() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.isReadOnly();
     }
 
-    synchronized public void setCatalog(String catalog) throws SqlException {
+    synchronized public void setCatalog(String catalog) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setCatalog(catalog);
     }
 
-    public String getCatalog() throws SqlException {
+    public String getCatalog() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getCatalog();
     }
 
     synchronized public java.sql.Statement createStatement(int resultSetType,
-                                                           int resultSetConcurrency) throws
SqlException {
+                                                           int resultSetConcurrency) throws
SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.createStatement(resultSetType, resultSetConcurrency);
     }
 
     synchronized public java.sql.PreparedStatement prepareStatement(String sql,
                                                                     int resultSetType,
-                                                                    int resultSetConcurrency)
throws SqlException {
+                                                                    int resultSetConcurrency)
throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency);
     }
 
     synchronized public java.sql.CallableStatement prepareCall(String sql,
                                                                int resultSetType,
-                                                               int resultSetConcurrency)
throws SqlException {
+                                                               int resultSetConcurrency)
throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareCall(sql, resultSetType, resultSetConcurrency);
     }
 
-    public java.util.Map getTypeMap() throws SqlException {
+    public java.util.Map getTypeMap() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getTypeMap();
     }
 
-    synchronized public void setTypeMap(java.util.Map map) throws SqlException {
+    synchronized public void setTypeMap(java.util.Map map) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setTypeMap(map);
     }
 
     public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency,
-                                              int resultSetHoldability) throws SqlException
{
+                                              int resultSetHoldability) throws SQLException
{
         checkForNullPhysicalConnection();
         return physicalConnection_.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
     }
 
     public java.sql.CallableStatement prepareCall(String sql, int resultSetType,
                                                   int resultSetConcurrency,
-                                                  int resultSetHoldability) throws SqlException
{
+                                                  int resultSetHoldability) throws SQLException
{
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareCall(sql, resultSetType, resultSetConcurrency,
resultSetHoldability);
     }
 
     public java.sql.PreparedStatement prepareStatement(String sql, int resultSetType,
                                                        int resultSetConcurrency, int resultSetHoldability)
-            throws SqlException {
+            throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency,
                 resultSetHoldability);
     }
 
     public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-            throws SqlException {
+            throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql, autoGeneratedKeys);
     }
 
     public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes[])
-            throws SqlException {
+            throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql, columnIndexes);
     }
 
     public java.sql.PreparedStatement prepareStatement(String sql, String columnNames[])
-            throws SqlException {
+            throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.prepareStatement(sql, columnNames);
     }
 
-    public void setHoldability(int holdability) throws SqlException {
+    public void setHoldability(int holdability) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.setHoldability(holdability);
     }
 
-    public int getHoldability() throws SqlException {
+    public int getHoldability() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.getHoldability();
     }
 
-    public java.sql.Savepoint setSavepoint() throws SqlException {
+    public java.sql.Savepoint setSavepoint() throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.setSavepoint();
     }
 
-    public java.sql.Savepoint setSavepoint(String name) throws SqlException {
+    public java.sql.Savepoint setSavepoint(String name) throws SQLException {
         checkForNullPhysicalConnection();
         return physicalConnection_.setSavepoint(name);
     }
 
-    public void rollback(java.sql.Savepoint savepoint) throws SqlException {
+    public void rollback(java.sql.Savepoint savepoint) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.rollback(savepoint);
     }
 
-    public void releaseSavepoint(java.sql.Savepoint savepoint) throws SqlException {
+    public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException {
         checkForNullPhysicalConnection();
         physicalConnection_.releaseSavepoint(savepoint);
     }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java?rev=371561&r1=371560&r2=371561&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java Mon
Jan 23 07:58:34 2006
@@ -20,6 +20,8 @@
 
 package org.apache.derby.client.am;
 
+import java.sql.SQLException;
+
 // Parameter meta data as used internally by the driver is always a column meta data instance.
 // We will only create instances of this class when getParameterMetaData() is called.
 // This class simply wraps a column meta data instance.
@@ -37,14 +39,14 @@
         columnMetaData_ = columnMetaData;
     }
 
-    public int getParameterCount() throws SqlException {
+    public int getParameterCount() throws SQLException {
         if (escapedProcedureCallWithResult_) {
             return columnMetaData_.columns_++;
         }
         return columnMetaData_.columns_;
     }
 
-    public int getParameterType(int param) throws SqlException {
+    public int getParameterType(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -54,7 +56,7 @@
         return columnMetaData_.getColumnType(param);
     }
 
-    public String getParameterTypeName(int param) throws SqlException {
+    public String getParameterTypeName(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -64,7 +66,7 @@
         return columnMetaData_.getColumnTypeName(param);
     }
 
-    public String getParameterClassName(int param) throws SqlException {
+    public String getParameterClassName(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -74,26 +76,33 @@
         return columnMetaData_.getColumnClassName(param);
     }
 
-    public int getParameterMode(int param) throws SqlException {
-        if (escapedProcedureCallWithResult_) {
-            param--;
-            if (param == 0) {
+    public int getParameterMode(int param) throws SQLException {
+        try
+        {
+            if (escapedProcedureCallWithResult_) {
+                param--;
+                if (param == 0) {
+                    return java.sql.ParameterMetaData.parameterModeOut;
+                }
+            }
+            columnMetaData_.checkForValidColumnIndex(param);
+            if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeUnknown)
{
+                return java.sql.ParameterMetaData.parameterModeUnknown;
+            } else if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeIn)
{
+                return java.sql.ParameterMetaData.parameterModeIn;
+            } else if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeOut)
{
                 return java.sql.ParameterMetaData.parameterModeOut;
+            } else {
+                return java.sql.ParameterMetaData.parameterModeInOut;
             }
         }
-        columnMetaData_.checkForValidColumnIndex(param);
-        if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeUnknown)
{
-            return java.sql.ParameterMetaData.parameterModeUnknown;
-        } else if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeIn)
{
-            return java.sql.ParameterMetaData.parameterModeIn;
-        } else if (columnMetaData_.sqlxParmmode_[param - 1] == java.sql.ParameterMetaData.parameterModeOut)
{
-            return java.sql.ParameterMetaData.parameterModeOut;
-        } else {
-            return java.sql.ParameterMetaData.parameterModeInOut;
+        catch ( SqlException se )
+        {
+            throw se.getSQLException();
         }
     }
 
-    public int isNullable(int param) throws SqlException {
+    public int isNullable(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -103,7 +112,7 @@
         return columnMetaData_.isNullable(param);
     }
 
-    public boolean isSigned(int param) throws SqlException {
+    public boolean isSigned(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -113,7 +122,7 @@
         return columnMetaData_.isSigned(param);
     }
 
-    public int getPrecision(int param) throws SqlException {
+    public int getPrecision(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {
@@ -123,7 +132,7 @@
         return columnMetaData_.getPrecision(param);
     }
 
-    public int getScale(int param) throws SqlException {
+    public int getScale(int param) throws SQLException {
         if (escapedProcedureCallWithResult_) {
             param--;
             if (param == 0) {



Mime
View raw message