001/* SQLOutput.java -- Write SQL values to a stream
002   Copyright (C) 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package java.sql;
040
041import java.io.InputStream;
042import java.io.Reader;
043import java.math.BigDecimal;
044import java.net.URL;
045
046/**
047 * This interface provides methods for writing Java types to a SQL stream.
048 * It is used for implemented custom type mappings for user defined data
049 * types.
050 *
051 * @author Aaron M. Renn (arenn@urbanophile.com)
052 */
053public interface SQLOutput
054{
055  /**
056   * This method writes the specified Java <code>String</code>
057   * to the SQL stream.
058   *
059   * @param value The value to write to the stream.
060   * @exception SQLException If an error occurs.
061   */
062  void writeString(String value) throws SQLException;
063
064  /**
065   * This method writes the specified Java <code>boolean</code>
066   * to the SQL stream.
067   *
068   * @param value The value to write to the stream.
069   * @exception SQLException If an error occurs.
070   */
071  void writeBoolean(boolean value) throws SQLException;
072
073  /**
074   * This method writes the specified Java <code>byte</code>
075   * to the SQL stream.
076   *
077   * @param value The value to write to the stream.
078   * @exception SQLException If an error occurs.
079   */
080  void writeByte(byte value) throws SQLException;
081
082  /**
083   * This method writes the specified Java <code>short</code>
084   * to the SQL stream.
085   *
086   * @param value The value to write to the stream.
087   * @exception SQLException If an error occurs.
088   */
089  void writeShort(short value) throws SQLException;
090
091  /**
092   * This method writes the specified Java <code>int</code>
093   * to the SQL stream.
094   *
095   * @param value The value to write to the stream.
096   * @exception SQLException If an error occurs.
097   */
098  void writeInt(int value) throws SQLException;
099
100  /**
101   * This method writes the specified Java <code>long</code>
102   * to the SQL stream.
103   *
104   * @param value The value to write to the stream.
105   * @exception SQLException If an error occurs.
106   */
107  void writeLong(long value) throws SQLException;
108
109  /**
110   * This method writes the specified Java <code>float</code>
111   * to the SQL stream.
112   *
113   * @param value The value to write to the stream.
114   * @exception SQLException If an error occurs.
115   */
116  void writeFloat(float value) throws SQLException;
117
118  /**
119   * This method writes the specified Java <code>double</code>
120   * to the SQL stream.
121   *
122   * @param value The value to write to the stream.
123   * @exception SQLException If an error occurs.
124   */
125  void writeDouble(double value) throws SQLException;
126
127  /**
128   * This method writes the specified Java <code>BigDecimal</code>
129   * to the SQL stream.
130   *
131   * @param value The value to write to the stream.
132   * @exception SQLException If an error occurs.
133   */
134  void writeBigDecimal(BigDecimal value) throws SQLException;
135
136  /**
137   * This method writes the specified Java <code>byte</code> array
138   * to the SQL stream.
139   *
140   * @param value The value to write to the stream.
141   * @exception SQLException If an error occurs.
142   */
143  void writeBytes(byte[] value) throws SQLException;
144
145  /**
146   * This method writes the specified Java <code>java.sql.Date</code>
147   * to the SQL stream.
148   *
149   * @param value The value to write to the stream.
150   * @exception SQLException If an error occurs.
151   */
152  void writeDate(Date value) throws SQLException;
153
154  /**
155   * This method writes the specified Java <code>java.sql.Time</code>
156   * to the SQL stream.
157   *
158   * @param value The value to write to the stream.
159   * @exception SQLException If an error occurs.
160   */
161  void writeTime(Time value) throws SQLException;
162
163  /**
164   * This method writes the specified Java <code>java.sql.Timestamp</code>
165   * to the SQL stream.
166   *
167   * @param value The value to write to the stream.
168   * @exception SQLException If an error occurs.
169   */
170  void writeTimestamp(Timestamp value) throws SQLException;
171
172  /**
173   * This method writes the specified Java character stream
174   * to the SQL stream.
175   *
176   * @param stream The stream that holds the character data to write.
177   * @exception SQLException If an error occurs.
178   */
179  void writeCharacterStream(Reader stream) throws SQLException;
180
181  /**
182   * This method writes the specified ASCII text stream
183   * to the SQL stream.
184   *
185   * @param stream The stream that holds the ASCII data to write.
186   * @exception SQLException If an error occurs.
187   */
188  void writeAsciiStream(InputStream stream) throws SQLException;
189
190  /**
191   * This method writes the specified uninterpreted binary byte stream
192   * to the SQL stream.
193   *
194   * @param stream The stream that holds the binary data to write.
195   * @exception SQLException If an error occurs.
196   */
197  void writeBinaryStream(InputStream stream) throws SQLException;
198
199  /**
200   * This method writes the specified Java <code>SQLData</code> object
201   * to the SQL stream.
202   *
203   * @param value The value to write to the stream.
204   * @exception SQLException If an error occurs.
205   */
206  void writeObject(SQLData value) throws SQLException;
207
208  /**
209   * This method writes the specified Java SQL <code>Ref</code> object
210   * to the SQL stream.
211   *
212   * @param value The <code>Ref</code> object to write to the stream.
213   * @exception SQLException If an error occurs.
214   * @see Ref
215   */
216  void writeRef(Ref value) throws SQLException;
217
218
219  /**
220   * This method writes the specified Java SQL <code>Blob</code> object
221   * to the SQL stream.
222   *
223   * @param value The <code>Blob</code> object to write to the stream.
224   * @exception SQLException If an error occurs.
225   * @see Blob
226   */
227  void writeBlob(Blob value) throws SQLException;
228
229  /**
230   * This method writes the specified Java SQL <code>Clob</code> object
231   * to the SQL stream.
232   *
233   * @param value The <code>Clob</code> object to write to the stream.
234   * @exception SQLException If an error occurs.
235   * @see Clob
236   */
237  void writeClob(Clob value) throws SQLException;
238
239  /**
240   * This method writes the specified Java SQL <code>Struct</code> object
241   * to the SQL stream.
242   *
243   * @param value The <code>Struct</code> object to write to the stream.
244   * @exception SQLException If an error occurs.
245   * @see Struct
246   */
247  void writeStruct(Struct value) throws SQLException;
248
249  /**
250   * This method writes the specified Java SQL <code>Array</code> object
251   * to the SQL stream.
252   *
253   * @param value The value to write to the stream.
254   * @exception SQLException If an error occurs.
255   */
256  void writeArray(Array value) throws SQLException;
257
258  /**
259   * This method writes the specified <code>java.net.URL</code> object to the
260   * SQL stream.
261   *
262   * @param value The value to write to the stream.
263   * @exception SQLException If an error occurs.
264   * @since 1.4
265   */
266  void writeURL(URL value) throws SQLException;
267}