KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > sqlmap > client > extensions > ParameterSetter


1 /*
2  * Copyright 2004 Clinton Begin
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.ibatis.sqlmap.client.extensions;
17
18 import java.io.InputStream JavaDoc;
19 import java.io.Reader JavaDoc;
20 import java.math.BigDecimal JavaDoc;
21 import java.net.URL JavaDoc;
22 import java.sql.*;
23 import java.util.Calendar JavaDoc;
24
25 /**
26  * Allows parameters to be set on the underlying prepared statement.
27  * TypeHandlerCallback implementations use this interface to
28  * process values before they are set on the prepared statement.
29  * Each of these methods has a corresponding method on the
30  * PreparedStatement class, the only difference being
31  * that there is no need to specify the parameter index with these
32  * methods.
33  * <p/>
34  * <b>NOTE:</b> There is no need to implement this. The implementation
35  * will be passed into the TypeHandlerCallback automatically.
36  */

37 public interface ParameterSetter {
38
39   /**
40    * Set an array on the underlying prepared statement
41    * @param x - the array to set
42    * @throws SQLException - thrown if the underlying prepared statement throws it
43    */

44   public void setArray(Array x) throws SQLException;
45
46   /**
47    * Set an InputStream on the underlying prepared statement
48    * @param x - the InputStream
49    * @param length - the length of the InputStream
50    * @throws SQLException - thrown if the underlying prepared statement throws it
51    */

52   public void setAsciiStream(InputStream JavaDoc x, int length) throws SQLException;
53
54   /**
55    * Set an on the underlying prepared statement
56    * @param x
57    * @throws SQLException - thrown if the underlying prepared statement throws it
58    */

59   public void setBigDecimal(BigDecimal JavaDoc x) throws SQLException;
60
61   /**
62    * Set an InputStream on the underlying prepared statement
63    * @param x - the InputStream
64    * @param length - the length of the InputStream
65    * @throws SQLException - thrown if the underlying prepared statement throws it
66    */

67   public void setBinaryStream(InputStream JavaDoc x, int length) throws SQLException;
68
69   /**
70    * Set a blob on the underlying prepared statement
71    * @param x - the blob
72    * @throws SQLException - thrown if the underlying prepared statement throws it
73    */

74   public void setBlob(Blob x) throws SQLException;
75
76   /**
77    * Set a boolean on the underlying prepared statement
78    * @param x - the boolean
79    * @throws SQLException - thrown if the underlying prepared statement throws it
80    */

81   public void setBoolean(boolean x) throws SQLException;
82
83   /**
84    * Set a byte on the underlying prepared statement
85    * @param x - the byte
86    * @throws SQLException - thrown if the underlying prepared statement throws it
87    */

88   public void setByte(byte x) throws SQLException;
89
90   /**
91    * Set a byte array on the underlying prepared statement
92    * @param x - the byte[]
93    * @throws SQLException - thrown if the underlying prepared statement throws it
94    */

95   public void setBytes(byte x[]) throws SQLException;
96
97   /**
98    * Set a character stream on the underlying prepared statement
99    * @param reader - the reader
100    * @param length - the length of the reader
101    * @throws SQLException - thrown if the underlying prepared statement throws it
102    */

103   public void setCharacterStream(Reader JavaDoc reader, int length) throws SQLException;
104
105   /**
106    * Set a clob on the underlying prepared statement
107    * @param x - the clob
108    * @throws SQLException - thrown if the underlying prepared statement throws it
109    */

110   public void setClob(Clob x) throws SQLException;
111
112   /**
113    * Set a date on the underlying prepared statement
114    * @param x - the date
115    * @throws SQLException - thrown if the underlying prepared statement throws it
116    */

117   public void setDate(Date x) throws SQLException;
118
119   /**
120    * Set a date with a calendar on the underlying prepared statement
121    * @param x - the date
122    * @param cal - the calendar
123    * @throws SQLException - thrown if the underlying prepared statement throws it
124    */

125   public void setDate(Date x, Calendar JavaDoc cal) throws SQLException;
126
127   /**
128    * Set a double on the underlying prepared statement
129    * @param x - the double
130    * @throws SQLException - thrown if the underlying prepared statement throws it
131    */

132   public void setDouble(double x) throws SQLException;
133
134   /**
135    * Set a float on the underlying prepared statement
136    * @param x the float
137    * @throws SQLException - thrown if the underlying prepared statement throws it
138    */

139   public void setFloat(float x) throws SQLException;
140
141   /**
142    * Set an integer on the underlying prepared statement
143    * @param x - the int
144    * @throws SQLException - thrown if the underlying prepared statement throws it
145    */

146   public void setInt(int x) throws SQLException;
147
148   /**
149    * Set a long on the underlying prepared statement
150    * @param x - the long
151    * @throws SQLException - thrown if the underlying prepared statement throws it
152    */

153   public void setLong(long x) throws SQLException;
154
155   /**
156    * Set a null on the underlying prepared statement
157    * @param sqlType - the type for the null value
158    * @throws SQLException - thrown if the underlying prepared statement throws it
159    */

160   public void setNull(int sqlType) throws SQLException;
161
162   /**
163    * Set a null on the underlying prepared statement
164    * @param sqlType - the type for the null value
165    * @param typeName - the name of the type
166    * @throws SQLException - thrown if the underlying prepared statement throws it
167    */

168   public void setNull(int sqlType, String JavaDoc typeName) throws SQLException;
169
170   /**
171    * Set an object on the underlying prepared statement
172    * @param x - the object to set
173    * @throws SQLException - thrown if the underlying prepared statement throws it
174    */

175   public void setObject(Object JavaDoc x) throws SQLException;
176
177   /**
178    * Set an object on the underlying prepared statement
179    * @param x - the object to set
180    * @param targetSqlType - the sql type of the object
181    * @throws SQLException - thrown if the underlying prepared statement throws it
182    */

183   public void setObject(Object JavaDoc x, int targetSqlType) throws SQLException;
184
185   /**
186    * Set an object on the underlying prepared statement
187    * @param x - the object to set
188    * @param targetSqlType - the sql type of the object
189    * @param scale - the scale of the object
190    * @throws SQLException - thrown if the underlying prepared statement throws it
191    */

192   public void setObject(Object JavaDoc x, int targetSqlType, int scale) throws SQLException;
193
194   /**
195    * Set a reference on the underlying prepared statement
196    * @param x - the reference to set
197    * @throws SQLException - thrown if the underlying prepared statement throws it
198    */

199   public void setRef(Ref x) throws SQLException;
200
201   /**
202    * Set a short on the underlying prepared statement
203    * @param x - the short to set
204    * @throws SQLException - thrown if the underlying prepared statement throws it
205    */

206   public void setShort(short x) throws SQLException;
207
208   /**
209    * Set a string on the underlying prepared statement
210    * @param x - the string to set
211    * @throws SQLException - thrown if the underlying prepared statement throws it
212    */

213   public void setString(String JavaDoc x) throws SQLException;
214
215   /**
216    * Set a time on the underlying prepared statement
217    * @param x - the time to set
218    * @throws SQLException - thrown if the underlying prepared statement throws it
219    */

220   public void setTime(Time x) throws SQLException;
221
222   /**
223    * Set a time with a calendar on the underlying prepared statement
224    * @param x - the time to set
225    * @param cal - the calendar to use
226    * @throws SQLException - thrown if the underlying prepared statement throws it
227    */

228   public void setTime(Time x, Calendar JavaDoc cal) throws SQLException;
229
230   /**
231    * Set a timestamp on the underlying prepared statement
232    * @param x - the timestamp to set
233    * @throws SQLException - thrown if the underlying prepared statement throws it
234    */

235   public void setTimestamp(Timestamp x) throws SQLException;
236
237   /**
238    * Set a timestamp on the underlying prepared statement
239    * @param x - the timestamp to set
240    * @param cal - the calendar to use
241    * @throws SQLException - thrown if the underlying prepared statement throws it
242    */

243   public void setTimestamp(Timestamp x, Calendar JavaDoc cal) throws SQLException;
244
245   /**
246    * Set a URL on the underlying prepared statement
247    * @param x - the url to set
248    * @throws SQLException - thrown if the underlying prepared statement throws it
249    */

250   public void setURL(URL JavaDoc x) throws SQLException;
251
252   /**
253    * Returns the underlying prepared statement...be careful!
254    */

255   public PreparedStatement getPreparedStatement();
256
257 }
258
Popular Tags