001 /*
002 
003    Derby - Class org.apache.derby.client.net.NetCallableStatement
004 
005    Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
006 
007    Licensed under the Apache License, Version 2.0 (the "License");
008    you may not use this file except in compliance with the License.
009    You may obtain a copy of the License at
010 
011       http://www.apache.org/licenses/LICENSE-2.0
012 
013    Unless required by applicable law or agreed to in writing, software
014    distributed under the License is distributed on an "AS IS" BASIS,
015    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016    See the License for the specific language governing permissions and
017    limitations under the License.
018 
019 */
020 package org.apache.derby.client.net;
021 
022 import org.apache.derby.client.am.CallableStatement;
023 import org.apache.derby.client.am.ColumnMetaData;
024 import org.apache.derby.client.am.MaterialPreparedStatement;
025 import org.apache.derby.client.am.Section;
026 import org.apache.derby.client.am.SqlException;
027 
028 public class NetCallableStatement extends NetPreparedStatement
029         implements MaterialPreparedStatement {
030 
031     CallableStatement callableStatement_;
032 
033     //-----------------------------state------------------------------------------
034 
035     //---------------------constructors/finalizer---------------------------------
036 
037     private void initNetCallableStatement() {
038         callableStatement_ = null;
039     }
040 
041     // Relay constructor for all NetCallableStatement constructors
042     NetCallableStatement(CallableStatement statement,
043                          NetAgent netAgent,
044                          NetConnection netConnectionthrows SqlException {
045         super(statement, netAgent, netConnection);
046         initNetCallableStatement();
047         initNetCallableStatement(statement);
048     }
049 
050     void resetNetCallableStatement(CallableStatement statement,
051                                    NetAgent netAgent,
052                                    NetConnection netConnectionthrows SqlException {
053         super.resetNetPreparedStatement(statement, netAgent, netConnection);
054         initNetCallableStatement();
055         initNetCallableStatement(statement);
056     }
057 
058     private void initNetCallableStatement(CallableStatement statementthrows SqlException {
059         callableStatement_ = statement;
060         callableStatement_.materialCallableStatement_ = this;
061 
062     }
063 
064 
065     // Called by abstract Connection.prepareCall().newCallableStatement()
066     // for jdbc 2 callable statements with scroll attributes.
067     NetCallableStatement(NetAgent netAgent,
068                          NetConnection netConnection,
069                          String sql,
070                          int type,
071                          int concurrency,
072                          int holdabilitythrows SqlException {
073         this(new CallableStatement(netAgent, netConnection, sql, type, concurrency, holdability),
074                 netAgent,
075                 netConnection);
076     }
077 
078     void resetNetCallableStatement(NetAgent netAgent,
079                                    NetConnection netConnection,
080                                    String sql,
081                                    int type,
082                                    int concurrency,
083                                    int holdabilitythrows SqlException {
084         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, type, concurrency, holdability);
085         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
086     }
087 
088     void resetNetCallableStatement(NetAgent netAgent,
089                                    NetConnection netConnection,
090                                    String sql,
091                                    Section sectionthrows SqlException {
092         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section);
093         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
094     }
095 
096 
097     void resetNetCallableStatement(NetAgent netAgent,
098                                    NetConnection netConnection,
099                                    String sql,
100                                    Section section,
101                                    ColumnMetaData parameterMetaData,
102                                    ColumnMetaData resultSetMetaDatathrows SqlException {
103         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData);
104         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
105     }
106 
107     protected void finalize() throws java.lang.Throwable {
108         super.finalize();
109     }
110 
111 }