KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > am > PreparedStatement40


1 /*
2
3    Derby - Class org.apache.derby.client.am.PreparedStatement40
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
22 package org.apache.derby.client.am;
23
24 import java.sql.RowId JavaDoc;
25 import java.sql.NClob JavaDoc;
26 import java.sql.SQLException JavaDoc;
27 import java.sql.SQLXML JavaDoc;
28 import java.io.Reader JavaDoc;
29 import java.io.InputStream JavaDoc;
30 import org.apache.derby.client.ClientPooledConnection;
31 import org.apache.derby.client.am.SqlException;
32 import org.apache.derby.client.am.ClientMessageId;
33 import org.apache.derby.shared.common.reference.SQLState;
34
35 public class PreparedStatement40 extends org.apache.derby.client.am.PreparedStatement{
36
37     /**
38      * The PreparedStatement used for JDBC 4 positioned update statements.
39      * Called by material statement constructors.
40      * It has the ClientPooledConnection as one of its parameters
41      * this is used to raise the Statement Events when the prepared
42      * statement is closed
43      *
44      * @param agent The instance of NetAgent associated with this
45      * CallableStatement object.
46      * @param connection The connection object associated with this
47      * PreparedStatement Object.
48      * @param sql A String object that is the SQL statement to be sent
49      * to the database.
50      * @param section Section
51      * @param cpc The ClientPooledConnection wraps the underlying physical
52      * connection associated with this prepared statement.
53      * It is used to pass the Statement closed and the Statement
54      * error occurred events that occur back to the
55      * ClientPooledConnection.
56      * @throws SqlException
57      */

58     public PreparedStatement40(Agent agent,
59         Connection connection,
60         String JavaDoc sql,
61         Section section,ClientPooledConnection cpc) throws SqlException {
62         super(agent, connection,sql,section,cpc);
63     }
64     
65     /**
66      * The PreparedStatementConstructor used for jdbc 4 prepared statements
67      * with scroll attributes. Called by material statement constructors.
68      * It has the ClientPooledConnection as one of its parameters
69      * this is used to raise the Statement Events when the prepared
70      * statement is closed
71      *
72     * @param agent The instance of NetAgent associated with this
73      * CallableStatement object.
74      * @param connection The connection object associated with this
75      * PreparedStatement Object.
76      * @param sql A String object that is the SQL statement
77      * to be sent to the database.
78      * @param type One of the ResultSet type constants.
79      * @param concurrency One of the ResultSet concurrency constants.
80      * @param holdability One of the ResultSet holdability constants.
81      * @param autoGeneratedKeys a flag indicating whether auto-generated
82      * keys should be returned.
83      * @param columnNames an array of column names indicating the columns that
84      * should be returned from the inserted row or rows.
85      * @param cpc The ClientPooledConnection wraps the underlying physical
86      * connection associated with this prepared statement
87      * it is used to pass the Statement closed and the Statement
88      * error occurred events that occur back to the
89      * ClientPooledConnection.
90      * @throws SqlException
91      */

92     public PreparedStatement40(Agent agent,
93         Connection connection,
94         String JavaDoc sql,
95         int type, int concurrency, int holdability, int autoGeneratedKeys, String JavaDoc[] columnNames,ClientPooledConnection cpc) throws SqlException {
96         super(agent, connection, sql, type, concurrency, holdability, autoGeneratedKeys, columnNames, cpc);
97     }
98     
99     
100     public void setRowId(int parameterIndex, RowId JavaDoc x) throws SQLException JavaDoc{
101         throw SQLExceptionFactory.notImplemented ("setRowId (int, RowId)");
102     }
103     
104     public void setNString(int index, String JavaDoc value) throws SQLException JavaDoc{
105         throw SQLExceptionFactory.notImplemented ("setNString (int, String)");
106     }
107
108     public void setNCharacterStream(int parameterIndex, Reader JavaDoc value)
109             throws SQLException JavaDoc {
110         throw SQLExceptionFactory.notImplemented("setNCharacterStream" +
111                 "(int,Reader)");
112     }
113
114     public void setNCharacterStream(int index, Reader JavaDoc value, long length)
115                 throws SQLException JavaDoc{
116         throw SQLExceptionFactory.notImplemented ("setNCharacterStream " +
117                 "(int,Reader,long)");
118     }
119
120     public void setNClob(int parameterIndex, Reader JavaDoc reader)
121             throws SQLException JavaDoc {
122         throw SQLExceptionFactory.notImplemented("setNClob(int,Reader)");
123     }
124
125     public void setNClob(int index, NClob JavaDoc value) throws SQLException JavaDoc{
126         throw SQLExceptionFactory.notImplemented ("setNClob (int, NClob)");
127     }
128     
129     public void setNClob(int parameterIndex, Reader JavaDoc reader, long length)
130     throws SQLException JavaDoc{
131         throw SQLExceptionFactory.notImplemented ("setNClob (int, Reader, long)");
132     }
133     
134     public void setSQLXML(int parameterIndex, SQLXML JavaDoc xmlObject)
135                 throws SQLException JavaDoc{
136         throw SQLExceptionFactory.notImplemented ("setSQLXML (int, SQLXML)");
137     }
138     
139     /**
140      * Returns <code>this</code> if this class implements the interface
141      *
142      * @param interfaces a Class defining an interface
143      * @return an object that implements the interface
144      * @throws java.sql.SQLExption if no object if found that implements the
145      * interface
146      */

147     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
148                                    throws SQLException JavaDoc {
149         try {
150             checkForClosedStatement();
151             return interfaces.cast(this);
152         } catch (ClassCastException JavaDoc cce) {
153             throw new SqlException(null,new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
154                     interfaces).getSQLException();
155         } catch (SqlException se) {
156             throw se.getSQLException();
157         }
158     }
159 }
160
Popular Tags