Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/LogicalConnection.java Sun May 1 23:25:59 2005 @@ -28,321 +28,288 @@ // Both the finalizer and close() methods will always set the physical connection to null. // After the physical conneciton is set to null, // only the Pooled Connection instance will maintain a handle to the physical connection. -public class LogicalConnection implements java.sql.Connection -{ - private Connection physicalConnection_ = null; // reset to null when the logical connection is closed. - private org.apache.derby.client.ClientPooledConnection pooledConnection_ = null; - - public LogicalConnection (Connection physicalConnection, - org.apache.derby.client.ClientPooledConnection pooledConnection) throws SqlException - { - physicalConnection_ = physicalConnection; - pooledConnection_ = pooledConnection; - checkForNullPhysicalConnection(); - } - - protected void finalize () throws java.lang.Throwable - { - close(); - } - - // Used by ClientPooledConnection close when it disassociates itself from the LogicalConnection - synchronized public void nullPhysicalConnection () - { - physicalConnection_ = null; - } - - // ------------------------ 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 - pooledConnection_.trashConnection (new SqlException (null, "Connection is stale.")); - - else { - physicalConnection_.closeForReuse(); - if ( ! physicalConnection_.isGlobalPending_() ) - pooledConnection_.recycleConnection(); - } - physicalConnection_ = null; - pooledConnection_.nullLogicalConnection(); - } - - synchronized public void closeWithoutRecyclingToPool () throws SqlException - { - if (physicalConnection_ == null) return; - physicalConnection_.checkForTransactionInProgress(); - try { - if (physicalConnection_.isClosed()) // connection is closed or has become stale - throw new SqlException (null, "Connection is stale."); // no call to trashConnection() - else { - ; // no call to recycleConnection() - } - } - finally { - physicalConnection_.closeForReuse(); //poolfix - physicalConnection_ = null; - } - } - - public boolean isClosed () throws SqlException - { - if (physicalConnection_ == null) return true; - return physicalConnection_.isClosed(); - } - - // --------------------------- helper methods -------------------------------- - - // 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 - { - if (physicalConnection_ == null) - throw new SqlException (null, " Attempt to use a closed connection. "); - } - - // ---------------------- wrapped public entry points ------------------------ - // All methods are forwarded to the physical connection in a standard way - - synchronized public java.sql.Statement createStatement () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.createStatement(); - } - - 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(); - return physicalConnection_.preparePositionedUpdateStatement (sql, querySection); - } - - synchronized public java.sql.CallableStatement prepareCall (String sql) throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareCall(sql); - } - - public String nativeSQL (String sql) throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.nativeSQL(sql); - } - - synchronized public void setAutoCommit (boolean autoCommit) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.setAutoCommit(autoCommit); - } - - public boolean getAutoCommit () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getAutoCommit(); - } - - synchronized public void commit () throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.commit(); - } - - synchronized public void rollback () throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.rollback(); - } - - synchronized public void setTransactionIsolation (int level) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.setTransactionIsolation(level); - } - - public int getTransactionIsolation () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getTransactionIsolation(); - } - - public java.sql.SQLWarning getWarnings () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getWarnings(); - } - - synchronized public void clearWarnings () throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.clearWarnings(); - } - - public java.sql.DatabaseMetaData getMetaData () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getMetaData(); - } - - synchronized public void setReadOnly (boolean readOnly) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.setReadOnly (readOnly); - } - - public boolean isReadOnly () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.isReadOnly(); - } - - synchronized public void setCatalog (String catalog) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.setCatalog(catalog); - } - - public String getCatalog () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getCatalog(); - } - - synchronized public java.sql.Statement createStatement (int resultSetType, - int resultSetConcurrency) throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.createStatement(resultSetType, resultSetConcurrency); - } - - synchronized public java.sql.PreparedStatement prepareStatement (String sql, - int resultSetType, - 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 - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareCall(sql, resultSetType, resultSetConcurrency); - } - - public java.util.Map getTypeMap () throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getTypeMap(); - } - - 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 - { - checkForNullPhysicalConnection(); - return physicalConnection_.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); - } - - public java.sql.CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, - 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 - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency, - resultSetHoldability); - } - - public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareStatement(sql, autoGeneratedKeys); - } - - public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes[]) - throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareStatement(sql, columnIndexes); - } - - public java.sql.PreparedStatement prepareStatement(String sql, String columnNames[]) - throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.prepareStatement(sql, columnNames); - } - - public void setHoldability(int holdability) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.setHoldability(holdability); - } - - public int getHoldability() throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.getHoldability(); - } - - public java.sql.Savepoint setSavepoint() throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.setSavepoint (); - } - - public java.sql.Savepoint setSavepoint(String name) throws SqlException - { - checkForNullPhysicalConnection(); - return physicalConnection_.setSavepoint (name); - } - - public void rollback(java.sql.Savepoint savepoint) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.rollback (savepoint); - } - - public void releaseSavepoint(java.sql.Savepoint savepoint) throws SqlException - { - checkForNullPhysicalConnection(); - physicalConnection_.releaseSavepoint (savepoint); - } - - //---------------------------------------------------------------------------- - - public int getServerVersion() - { - if (physicalConnection_ == null) - return -1; - else - return physicalConnection_.getServerVersion(); - } + +public class LogicalConnection implements java.sql.Connection { + private Connection physicalConnection_ = null; // reset to null when the logical connection is closed. + private org.apache.derby.client.ClientPooledConnection pooledConnection_ = null; + + public LogicalConnection(Connection physicalConnection, + org.apache.derby.client.ClientPooledConnection pooledConnection) throws SqlException { + physicalConnection_ = physicalConnection; + pooledConnection_ = pooledConnection; + checkForNullPhysicalConnection(); + } + + protected void finalize() throws java.lang.Throwable { + close(); + } + + // Used by ClientPooledConnection close when it disassociates itself from the LogicalConnection + synchronized public void nullPhysicalConnection() { + physicalConnection_ = null; + } + + // ------------------------ 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 + { + pooledConnection_.trashConnection(new SqlException(null, "Connection is stale.")); + } else { + physicalConnection_.closeForReuse(); + if (!physicalConnection_.isGlobalPending_()) { + pooledConnection_.recycleConnection(); + } + } + physicalConnection_ = null; + pooledConnection_.nullLogicalConnection(); + } + + synchronized public void closeWithoutRecyclingToPool() throws SqlException { + if (physicalConnection_ == null) { + return; + } + physicalConnection_.checkForTransactionInProgress(); + try { + if (physicalConnection_.isClosed()) // connection is closed or has become stale + { + throw new SqlException(null, "Connection is stale."); // no call to trashConnection() + } else { + ; // no call to recycleConnection() + } + } finally { + physicalConnection_.closeForReuse(); //poolfix + physicalConnection_ = null; + } + } + + public boolean isClosed() throws SqlException { + if (physicalConnection_ == null) { + return true; + } + return physicalConnection_.isClosed(); + } + + // --------------------------- helper methods -------------------------------- + + // 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 { + if (physicalConnection_ == null) { + throw new SqlException(null, " Attempt to use a closed connection. "); + } + } + + // ---------------------- wrapped public entry points ------------------------ + // All methods are forwarded to the physical connection in a standard way + + synchronized public java.sql.Statement createStatement() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.createStatement(); + } + + 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(); + return physicalConnection_.preparePositionedUpdateStatement(sql, querySection); + } + + synchronized public java.sql.CallableStatement prepareCall(String sql) throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareCall(sql); + } + + public String nativeSQL(String sql) throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.nativeSQL(sql); + } + + synchronized public void setAutoCommit(boolean autoCommit) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.setAutoCommit(autoCommit); + } + + public boolean getAutoCommit() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getAutoCommit(); + } + + synchronized public void commit() throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.commit(); + } + + synchronized public void rollback() throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.rollback(); + } + + synchronized public void setTransactionIsolation(int level) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.setTransactionIsolation(level); + } + + public int getTransactionIsolation() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getTransactionIsolation(); + } + + public java.sql.SQLWarning getWarnings() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getWarnings(); + } + + synchronized public void clearWarnings() throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.clearWarnings(); + } + + public java.sql.DatabaseMetaData getMetaData() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getMetaData(); + } + + synchronized public void setReadOnly(boolean readOnly) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.setReadOnly(readOnly); + } + + public boolean isReadOnly() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.isReadOnly(); + } + + synchronized public void setCatalog(String catalog) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.setCatalog(catalog); + } + + public String getCatalog() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getCatalog(); + } + + synchronized public java.sql.Statement createStatement(int resultSetType, + int resultSetConcurrency) throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.createStatement(resultSetType, resultSetConcurrency); + } + + synchronized public java.sql.PreparedStatement prepareStatement(String sql, + int resultSetType, + 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 { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareCall(sql, resultSetType, resultSetConcurrency); + } + + public java.util.Map getTypeMap() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getTypeMap(); + } + + 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 { + checkForNullPhysicalConnection(); + return physicalConnection_.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); + } + + public java.sql.CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, + 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 { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency, + resultSetHoldability); + } + + public java.sql.PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareStatement(sql, autoGeneratedKeys); + } + + public java.sql.PreparedStatement prepareStatement(String sql, int columnIndexes[]) + throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareStatement(sql, columnIndexes); + } + + public java.sql.PreparedStatement prepareStatement(String sql, String columnNames[]) + throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.prepareStatement(sql, columnNames); + } + + public void setHoldability(int holdability) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.setHoldability(holdability); + } + + public int getHoldability() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.getHoldability(); + } + + public java.sql.Savepoint setSavepoint() throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.setSavepoint(); + } + + public java.sql.Savepoint setSavepoint(String name) throws SqlException { + checkForNullPhysicalConnection(); + return physicalConnection_.setSavepoint(name); + } + + public void rollback(java.sql.Savepoint savepoint) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.rollback(savepoint); + } + + public void releaseSavepoint(java.sql.Savepoint savepoint) throws SqlException { + checkForNullPhysicalConnection(); + physicalConnection_.releaseSavepoint(savepoint); + } + + //---------------------------------------------------------------------------- + + public int getServerVersion() { + if (physicalConnection_ == null) { + return -1; + } else { + return physicalConnection_.getServerVersion(); + } + } }
Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialPreparedStatement.java Sun May 1 23:25:59 2005 @@ -20,41 +20,41 @@ package org.apache.derby.client.am; -import org.apache.derby.client.am.Section; -public interface MaterialPreparedStatement extends MaterialStatement -{ +public interface MaterialPreparedStatement extends MaterialStatement { - // ------------------------ abstract box car and callback methods -------------------------------- - public abstract void writeExecute_ (Section section, - ColumnMetaData parameterMetaData, - Object[] inputs, - int numInputColumns, - boolean outputExpected, - // This is a hint to the material layer that more write commands will follow. - // It is ignored by the driver in all cases except when blob data is written, - // in which case this boolean is used to optimize the implementation. - // Otherwise we wouldn't be able to chain after blob data is sent. - // Current servers have a restriction that blobs can only be chained with blobs - // Can the blob code - boolean chainedWritesFollowingSetLob - ) throws SqlException; - - - public abstract void readExecute_ () throws SqlException; - - public abstract void writeOpenQuery_ (Section section, - int fetchSize, - int resultSetType, - int numInputColumns, - ColumnMetaData parameterMetaData, - Object[] inputs - ) throws SqlException; - public abstract void writeDescribeInput_ (Section section) throws SqlException; - public abstract void readDescribeInput_ () throws SqlException; + // ------------------------ abstract box car and callback methods -------------------------------- - public abstract void writeDescribeOutput_ (Section section) throws SqlException; - public abstract void readDescribeOutput_ () throws SqlException; + public abstract void writeExecute_(Section section, + ColumnMetaData parameterMetaData, + Object[] inputs, + int numInputColumns, + boolean outputExpected, + // This is a hint to the material layer that more write commands will follow. + // It is ignored by the driver in all cases except when blob data is written, + // in which case this boolean is used to optimize the implementation. + // Otherwise we wouldn't be able to chain after blob data is sent. + // Current servers have a restriction that blobs can only be chained with blobs + // Can the blob code + boolean chainedWritesFollowingSetLob) throws SqlException; + + + public abstract void readExecute_() throws SqlException; + + public abstract void writeOpenQuery_(Section section, + int fetchSize, + int resultSetType, + int numInputColumns, + ColumnMetaData parameterMetaData, + Object[] inputs) throws SqlException; + + public abstract void writeDescribeInput_(Section section) throws SqlException; + + public abstract void readDescribeInput_() throws SqlException; + + public abstract void writeDescribeOutput_(Section section) throws SqlException; + + public abstract void readDescribeOutput_() throws SqlException; } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/MaterialStatement.java Sun May 1 23:25:59 2005 @@ -20,45 +20,51 @@ package org.apache.derby.client.am; -import org.apache.derby.client.am.Section; -public interface MaterialStatement -{ - public abstract void writeExecuteImmediate_ (String sql, Section section) throws SqlException; - public abstract void readExecuteImmediate_ () throws SqlException; - // The sql parameter is supplied in the read method for drivers that - // process all commands on the "read-side" and do little/nothing on the "write-side". - // Drivers that follow the write/read paradigm (e.g. NET) will likely ignore the sql parameter. - public abstract void readExecuteImmediateForBatch_ (String sql) throws SqlException; - - public abstract void writePrepareDescribeOutput_ (String sql, Section section) throws SqlException; - public abstract void readPrepareDescribeOutput_ () throws SqlException; - - public abstract void writeOpenQuery_ (Section section, - int fetchSize, - int resultSetType) throws SqlException; - public abstract void readOpenQuery_ () throws SqlException; - - public abstract void writeExecuteCall_ (boolean outputExpected, - String procedureName, - Section section, - int fetchSize, - boolean suppressResultSets, // for batch updates set to true, otherwise to false - int resultSetType, - ColumnMetaData parameterMetaData, - Object[] inputs) throws SqlException; - public abstract void readExecuteCall_ () throws SqlException; - - // Used for re-prepares across commit and other places as well - public abstract void writePrepare_ (String sql, Section section) throws SqlException; - public abstract void readPrepare_ () throws SqlException; - public abstract void markClosedOnServer_(); +public interface MaterialStatement { + public abstract void writeExecuteImmediate_(String sql, Section section) throws SqlException; - public abstract void writeSetSpecialRegister_ (java.util.ArrayList sqlsttList) throws SqlException; - public abstract void readSetSpecialRegister_ () throws SqlException; + public abstract void readExecuteImmediate_() throws SqlException; - public abstract void reset_ (); + // The sql parameter is supplied in the read method for drivers that + // process all commands on the "read-side" and do little/nothing on the "write-side". + // Drivers that follow the write/read paradigm (e.g. NET) will likely ignore the sql parameter. + public abstract void readExecuteImmediateForBatch_(String sql) throws SqlException; + + public abstract void writePrepareDescribeOutput_(String sql, Section section) throws SqlException; + + public abstract void readPrepareDescribeOutput_() throws SqlException; + + public abstract void writeOpenQuery_(Section section, + int fetchSize, + int resultSetType) throws SqlException; + + public abstract void readOpenQuery_() throws SqlException; + + public abstract void writeExecuteCall_(boolean outputExpected, + String procedureName, + Section section, + int fetchSize, + boolean suppressResultSets, // for batch updates set to true, otherwise to false + int resultSetType, + ColumnMetaData parameterMetaData, + Object[] inputs) throws SqlException; + + public abstract void readExecuteCall_() throws SqlException; + + // Used for re-prepares across commit and other places as well + public abstract void writePrepare_(String sql, Section section) throws SqlException; + + public abstract void readPrepare_() throws SqlException; + + public abstract void markClosedOnServer_(); + + public abstract void writeSetSpecialRegister_(java.util.ArrayList sqlsttList) throws SqlException; + + public abstract void readSetSpecialRegister_() throws SqlException; + + public abstract void reset_(); } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/ParameterMetaData.java Sun May 1 23:25:59 2005 @@ -26,120 +26,112 @@ // // Once we go to JDK 1.4 as runtime pre-req, we can extend ColumnMetaData and new up ParameterMetaData instances directly, // and we won't have to wrap column meta data instances directly. -public class ParameterMetaData implements java.sql.ParameterMetaData -{ - ColumnMetaData columnMetaData_; - - // This is false unless for parameterMetaData for a call statement with return clause - boolean escapedProcedureCallWithResult_ = false; - - public ParameterMetaData (ColumnMetaData columnMetaData) - { - columnMetaData_ = columnMetaData; - } - - public int getParameterCount () throws SqlException - { - if (escapedProcedureCallWithResult_) - return columnMetaData_.columns_++; - return columnMetaData_.columns_; - } - - public int getParameterType (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return java.sql.Types.INTEGER; - } - return columnMetaData_.getColumnType (param); - } - - public String getParameterTypeName (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return "INTEGER"; - } - return columnMetaData_.getColumnTypeName (param); - } - - public String getParameterClassName (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return "java.lang.Integer"; - } - return columnMetaData_.getColumnClassName (param); - } - - public int getParameterMode (int param) throws SqlException - { - 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; - } - - public int isNullable (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return java.sql.ResultSetMetaData.columnNoNulls; - } - return columnMetaData_.isNullable (param); - } - - public boolean isSigned (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return true; - } - return columnMetaData_.isSigned (param); - } - - public int getPrecision (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return 10; - } - return columnMetaData_.getPrecision (param); - } - - public int getScale (int param) throws SqlException - { - if (escapedProcedureCallWithResult_) - { - param--; - if (param == 0) - return 0; + +public class ParameterMetaData implements java.sql.ParameterMetaData { + ColumnMetaData columnMetaData_; + + // This is false unless for parameterMetaData for a call statement with return clause + boolean escapedProcedureCallWithResult_ = false; + + public ParameterMetaData(ColumnMetaData columnMetaData) { + columnMetaData_ = columnMetaData; + } + + public int getParameterCount() throws SqlException { + if (escapedProcedureCallWithResult_) { + return columnMetaData_.columns_++; + } + return columnMetaData_.columns_; + } + + public int getParameterType(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return java.sql.Types.INTEGER; + } + } + return columnMetaData_.getColumnType(param); + } + + public String getParameterTypeName(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return "INTEGER"; + } + } + return columnMetaData_.getColumnTypeName(param); + } + + public String getParameterClassName(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return "java.lang.Integer"; + } + } + return columnMetaData_.getColumnClassName(param); + } + + public int getParameterMode(int param) throws SqlException { + 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; + } + } + + public int isNullable(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return java.sql.ResultSetMetaData.columnNoNulls; + } + } + return columnMetaData_.isNullable(param); + } + + public boolean isSigned(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return true; + } + } + return columnMetaData_.isSigned(param); + } + + public int getPrecision(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return 10; + } + } + return columnMetaData_.getPrecision(param); + } + + public int getScale(int param) throws SqlException { + if (escapedProcedureCallWithResult_) { + param--; + if (param == 0) { + return 0; + } + } + return columnMetaData_.getScale(param); } - return columnMetaData_.getScale (param); - } }