001: /*
002: * Copyright 2004 Clinton Begin
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package com.ibatis.sqlmap.engine.type;
017:
018: import com.ibatis.sqlmap.client.extensions.ParameterSetter;
019:
020: import java.io.InputStream;
021: import java.io.Reader;
022: import java.math.BigDecimal;
023: import java.net.URL;
024: import java.sql.*;
025: import java.util.Calendar;
026:
027: /**
028: * A ParameterSetter implementation
029: */
030: public class ParameterSetterImpl implements ParameterSetter {
031:
032: private PreparedStatement ps;
033: private int index;
034:
035: /**
036: * Creates an instance for a PreparedStatement and column index
037: *
038: * @param statement - the PreparedStatement
039: * @param columnIndex - the column index
040: */
041: public ParameterSetterImpl(PreparedStatement statement,
042: int columnIndex) {
043: this .ps = statement;
044: this .index = columnIndex;
045: }
046:
047: public void setArray(Array x) throws SQLException {
048: ps.setArray(index, x);
049: }
050:
051: public void setAsciiStream(InputStream x, int length)
052: throws SQLException {
053: ps.setAsciiStream(index, x, length);
054: }
055:
056: public void setBigDecimal(BigDecimal x) throws SQLException {
057: ps.setBigDecimal(index, x);
058: }
059:
060: public void setBinaryStream(InputStream x, int length)
061: throws SQLException {
062: ps.setBinaryStream(index, x, length);
063: }
064:
065: public void setBlob(Blob x) throws SQLException {
066: ps.setBlob(index, x);
067: }
068:
069: public void setBoolean(boolean x) throws SQLException {
070: ps.setBoolean(index, x);
071: }
072:
073: public void setByte(byte x) throws SQLException {
074: ps.setByte(index, x);
075: }
076:
077: public void setBytes(byte x[]) throws SQLException {
078: ps.setBytes(index, x);
079: }
080:
081: public void setCharacterStream(Reader reader, int length)
082: throws SQLException {
083: ps.setCharacterStream(index, reader, length);
084: }
085:
086: public void setClob(Clob x) throws SQLException {
087: ps.setClob(index, x);
088: }
089:
090: public void setDate(Date x) throws SQLException {
091: ps.setDate(index, x);
092: }
093:
094: public void setDate(Date x, Calendar cal) throws SQLException {
095: ps.setDate(index, x, cal);
096: }
097:
098: public void setDouble(double x) throws SQLException {
099: ps.setDouble(index, x);
100: }
101:
102: public void setFloat(float x) throws SQLException {
103: ps.setFloat(index, x);
104: }
105:
106: public void setInt(int x) throws SQLException {
107: ps.setInt(index, x);
108: }
109:
110: public void setLong(long x) throws SQLException {
111: ps.setLong(index, x);
112: }
113:
114: public void setNull(int sqlType) throws SQLException {
115: ps.setNull(index, sqlType);
116: }
117:
118: public void setNull(int sqlType, String typeName)
119: throws SQLException {
120: ps.setNull(index, sqlType, typeName);
121: }
122:
123: public void setObject(Object x) throws SQLException {
124: ps.setObject(index, x);
125: }
126:
127: public void setObject(Object x, int targetSqlType)
128: throws SQLException {
129: ps.setObject(index, x, targetSqlType);
130: }
131:
132: public void setObject(Object x, int targetSqlType, int scale)
133: throws SQLException {
134: ps.setObject(index, x, scale);
135: }
136:
137: public void setRef(Ref x) throws SQLException {
138: ps.setRef(index, x);
139: }
140:
141: public void setShort(short x) throws SQLException {
142: ps.setShort(index, x);
143: }
144:
145: public void setString(String x) throws SQLException {
146: ps.setString(index, x);
147: }
148:
149: public void setTime(Time x) throws SQLException {
150: ps.setTime(index, x);
151: }
152:
153: public void setTime(Time x, Calendar cal) throws SQLException {
154: ps.setTime(index, x, cal);
155: }
156:
157: public void setTimestamp(Timestamp x) throws SQLException {
158: ps.setTimestamp(index, x);
159: }
160:
161: public void setTimestamp(Timestamp x, Calendar cal)
162: throws SQLException {
163: ps.setTimestamp(index, x, cal);
164: }
165:
166: public void setURL(URL x) throws SQLException {
167: ps.setURL(index, x);
168: }
169:
170: public PreparedStatement getPreparedStatement() {
171: return ps;
172: }
173:
174: public int getParameterIndex() {
175: return index;
176: }
177: }
|