1 | /* |
2 | |
3 | Derby - Class org.apache.derby.client.net.NetCallableStatement |
4 | |
5 | Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | package org.apache.derby.client.net; |
21 | |
22 | import org.apache.derby.client.am.CallableStatement; |
23 | import org.apache.derby.client.am.ColumnMetaData; |
24 | import org.apache.derby.client.am.MaterialPreparedStatement; |
25 | import org.apache.derby.client.am.Section; |
26 | import org.apache.derby.client.am.SqlException; |
27 | import org.apache.derby.jdbc.ClientDriver; |
28 | import org.apache.derby.client.am.ClientJDBCObjectFactory; |
29 | import org.apache.derby.client.ClientPooledConnection; |
30 | |
31 | public class NetCallableStatement extends NetPreparedStatement |
32 | implements MaterialPreparedStatement { |
33 | |
34 | CallableStatement callableStatement_; |
35 | |
36 | //-----------------------------state------------------------------------------ |
37 | |
38 | //---------------------constructors/finalizer--------------------------------- |
39 | |
40 | private void initNetCallableStatement() { |
41 | callableStatement_ = null; |
42 | } |
43 | |
44 | // Relay constructor for all NetCallableStatement constructors |
45 | NetCallableStatement(CallableStatement statement, |
46 | NetAgent netAgent, |
47 | NetConnection netConnection) throws SqlException { |
48 | super(statement, netAgent, netConnection); |
49 | initNetCallableStatement(); |
50 | initNetCallableStatement(statement); |
51 | } |
52 | |
53 | void resetNetCallableStatement(CallableStatement statement, |
54 | NetAgent netAgent, |
55 | NetConnection netConnection) throws SqlException { |
56 | super.resetNetPreparedStatement(statement, netAgent, netConnection); |
57 | initNetCallableStatement(); |
58 | initNetCallableStatement(statement); |
59 | } |
60 | |
61 | private void initNetCallableStatement(CallableStatement statement) throws SqlException { |
62 | callableStatement_ = statement; |
63 | callableStatement_.materialCallableStatement_ = this; |
64 | |
65 | } |
66 | |
67 | |
68 | // Called by abstract Connection.prepareCall().newCallableStatement() |
69 | // for jdbc 2 callable statements with scroll attributes. |
70 | NetCallableStatement(NetAgent netAgent, |
71 | NetConnection netConnection, |
72 | String sql, |
73 | int type, |
74 | int concurrency, |
75 | int holdability, |
76 | ClientPooledConnection cpc) throws SqlException { |
77 | this(ClientDriver.getFactory().newCallableStatement(netAgent, |
78 | netConnection, sql, type, concurrency, holdability,cpc), |
79 | netAgent, |
80 | netConnection); |
81 | } |
82 | |
83 | void resetNetCallableStatement(NetAgent netAgent, |
84 | NetConnection netConnection, |
85 | String sql, |
86 | int type, |
87 | int concurrency, |
88 | int holdability) throws SqlException { |
89 | callableStatement_.resetCallableStatement(netAgent, netConnection, sql, type, concurrency, holdability); |
90 | resetNetCallableStatement(callableStatement_, netAgent, netConnection); |
91 | } |
92 | |
93 | void resetNetCallableStatement(NetAgent netAgent, |
94 | NetConnection netConnection, |
95 | String sql, |
96 | Section section) throws SqlException { |
97 | callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section); |
98 | resetNetCallableStatement(callableStatement_, netAgent, netConnection); |
99 | } |
100 | |
101 | |
102 | void resetNetCallableStatement(NetAgent netAgent, |
103 | NetConnection netConnection, |
104 | String sql, |
105 | Section section, |
106 | ColumnMetaData parameterMetaData, |
107 | ColumnMetaData resultSetMetaData) throws SqlException { |
108 | callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData); |
109 | resetNetCallableStatement(callableStatement_, netAgent, netConnection); |
110 | } |
111 | |
112 | protected void finalize() throws java.lang.Throwable { |
113 | super.finalize(); |
114 | } |
115 | |
116 | } |