KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > net > NetCallableStatement


1 /*
2
3    Derby - Class org.apache.derby.client.net.NetCallableStatement
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21 package org.apache.derby.client.net;
22
23 import org.apache.derby.client.am.CallableStatement;
24 import org.apache.derby.client.am.ColumnMetaData;
25 import org.apache.derby.client.am.MaterialPreparedStatement;
26 import org.apache.derby.client.am.Section;
27 import org.apache.derby.client.am.SqlException;
28 import org.apache.derby.jdbc.ClientDriver;
29 import org.apache.derby.client.am.ClientJDBCObjectFactory;
30 import org.apache.derby.client.ClientPooledConnection;
31
32 public class NetCallableStatement extends NetPreparedStatement
33         implements MaterialPreparedStatement {
34
35     CallableStatement callableStatement_;
36
37     //-----------------------------state------------------------------------------
38

39     //---------------------constructors/finalizer---------------------------------
40

41     private void initNetCallableStatement() {
42         callableStatement_ = null;
43     }
44
45     // Relay constructor for all NetCallableStatement constructors
46
NetCallableStatement(CallableStatement statement,
47                          NetAgent netAgent,
48                          NetConnection netConnection) throws SqlException {
49         super(statement, netAgent, netConnection);
50         initNetCallableStatement();
51         initNetCallableStatement(statement);
52     }
53
54     void resetNetCallableStatement(CallableStatement statement,
55                                    NetAgent netAgent,
56                                    NetConnection netConnection) throws SqlException {
57         super.resetNetPreparedStatement(statement, netAgent, netConnection);
58         initNetCallableStatement();
59         initNetCallableStatement(statement);
60     }
61
62     private void initNetCallableStatement(CallableStatement statement) throws SqlException {
63         callableStatement_ = statement;
64         callableStatement_.materialCallableStatement_ = this;
65
66     }
67
68
69     // Called by abstract Connection.prepareCall().newCallableStatement()
70
// for jdbc 2 callable statements with scroll attributes.
71
NetCallableStatement(NetAgent netAgent,
72                          NetConnection netConnection,
73                          String JavaDoc sql,
74                          int type,
75                          int concurrency,
76                          int holdability,
77                          ClientPooledConnection cpc) throws SqlException {
78         this(ClientDriver.getFactory().newCallableStatement(netAgent,
79                 netConnection, sql, type, concurrency, holdability,cpc),
80                 netAgent,
81                 netConnection);
82     }
83
84     void resetNetCallableStatement(NetAgent netAgent,
85                                    NetConnection netConnection,
86                                    String JavaDoc sql,
87                                    int type,
88                                    int concurrency,
89                                    int holdability) throws SqlException {
90         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, type, concurrency, holdability);
91         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
92     }
93
94     void resetNetCallableStatement(NetAgent netAgent,
95                                    NetConnection netConnection,
96                                    String JavaDoc sql,
97                                    Section section) throws SqlException {
98         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section);
99         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
100     }
101
102
103     void resetNetCallableStatement(NetAgent netAgent,
104                                    NetConnection netConnection,
105                                    String JavaDoc sql,
106                                    Section section,
107                                    ColumnMetaData parameterMetaData,
108                                    ColumnMetaData resultSetMetaData) throws SqlException {
109         callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData);
110         resetNetCallableStatement(callableStatement_, netAgent, netConnection);
111     }
112
113     protected void finalize() throws java.lang.Throwable JavaDoc {
114         super.finalize();
115     }
116
117 }
118
Popular Tags