KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > sqlmap > engine > type > ParameterSetterImpl


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.engine.type;
17
18 import com.ibatis.sqlmap.client.extensions.ParameterSetter;
19
20 import java.io.InputStream JavaDoc;
21 import java.io.Reader JavaDoc;
22 import java.math.BigDecimal JavaDoc;
23 import java.net.URL JavaDoc;
24 import java.sql.*;
25 import java.util.Calendar JavaDoc;
26
27 /**
28  * A ParameterSetter implementation
29  */

30 public class ParameterSetterImpl implements ParameterSetter {
31
32   private PreparedStatement ps;
33   private int index;
34
35   /**
36    * Creates an instance for a PreparedStatement and column index
37    *
38    * @param statement - the PreparedStatement
39    * @param columnIndex - the column index
40    */

41   public ParameterSetterImpl(PreparedStatement statement, int columnIndex) {
42     this.ps = statement;
43     this.index = columnIndex;
44   }
45
46   public void setArray(Array x) throws SQLException {
47     ps.setArray(index, x);
48   }
49
50   public void setAsciiStream(InputStream JavaDoc x, int length) throws SQLException {
51     ps.setAsciiStream(index, x, length);
52   }
53
54   public void setBigDecimal(BigDecimal JavaDoc x) throws SQLException {
55     ps.setBigDecimal(index, x);
56   }
57
58   public void setBinaryStream(InputStream JavaDoc x, int length) throws SQLException {
59     ps.setBinaryStream(index, x, length);
60   }
61
62   public void setBlob(Blob x) throws SQLException {
63     ps.setBlob(index, x);
64   }
65
66   public void setBoolean(boolean x) throws SQLException {
67     ps.setBoolean(index, x);
68   }
69
70   public void setByte(byte x) throws SQLException {
71     ps.setByte(index, x);
72   }
73
74   public void setBytes(byte x[]) throws SQLException {
75     ps.setBytes(index, x);
76   }
77
78   public void setCharacterStream(Reader JavaDoc reader, int length) throws SQLException {
79     ps.setCharacterStream(index, reader, length);
80   }
81
82   public void setClob(Clob x) throws SQLException {
83     ps.setClob(index, x);
84   }
85
86   public void setDate(Date x) throws SQLException {
87     ps.setDate(index, x);
88   }
89
90   public void setDate(Date x, Calendar JavaDoc cal) throws SQLException {
91     ps.setDate(index, x, cal);
92   }
93
94   public void setDouble(double x) throws SQLException {
95     ps.setDouble(index, x);
96   }
97
98   public void setFloat(float x) throws SQLException {
99     ps.setFloat(index, x);
100   }
101
102   public void setInt(int x) throws SQLException {
103     ps.setInt(index, x);
104   }
105
106   public void setLong(long x) throws SQLException {
107     ps.setLong(index, x);
108   }
109
110   public void setNull(int sqlType) throws SQLException {
111     ps.setNull(index, sqlType);
112   }
113
114   public void setNull(int sqlType, String JavaDoc typeName) throws SQLException {
115     ps.setNull(index, sqlType, typeName);
116   }
117
118   public void setObject(Object JavaDoc x) throws SQLException {
119     ps.setObject(index, x);
120   }
121
122   public void setObject(Object JavaDoc x, int targetSqlType) throws SQLException {
123     ps.setObject(index, x, targetSqlType);
124   }
125
126   public void setObject(Object JavaDoc x, int targetSqlType, int scale) throws SQLException {
127     ps.setObject(index, x, scale);
128   }
129
130   public void setRef(Ref x) throws SQLException {
131     ps.setRef(index, x);
132   }
133
134   public void setShort(short x) throws SQLException {
135     ps.setShort(index, x);
136   }
137
138   public void setString(String JavaDoc x) throws SQLException {
139     ps.setString(index, x);
140   }
141
142   public void setTime(Time x) throws SQLException {
143     ps.setTime(index, x);
144   }
145
146   public void setTime(Time x, Calendar JavaDoc cal) throws SQLException {
147     ps.setTime(index, x, cal);
148   }
149
150   public void setTimestamp(Timestamp x) throws SQLException {
151     ps.setTimestamp(index, x);
152   }
153
154   public void setTimestamp(Timestamp x, Calendar JavaDoc cal) throws SQLException {
155     ps.setTimestamp(index, x, cal);
156   }
157
158   public void setURL(URL JavaDoc x) throws SQLException {
159     ps.setURL(index, x);
160   }
161
162   public PreparedStatement getPreparedStatement() {
163     return ps;
164   }
165
166 }
167
Popular Tags