1 |
/* SQLInput.java -- Read SQL values from a stream |
/* SQLInput.java -- Read SQL values from a stream |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
41 |
import java.io.InputStream; |
import java.io.InputStream; |
42 |
import java.io.Reader; |
import java.io.Reader; |
43 |
import java.math.BigDecimal; |
import java.math.BigDecimal; |
44 |
|
import java.net.URL; |
45 |
|
|
46 |
/** |
/** |
47 |
* This interface provides methods for reading values from a stream |
* This interface provides methods for reading values from a stream |
48 |
* that is connected to a SQL structured or distinct type. It is used |
* that is connected to a SQL structured or distinct type. It is used |
49 |
* for custom mapping of user defined data types. |
* for custom mapping of user defined data types. |
50 |
* |
* |
51 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
52 |
*/ |
*/ |
53 |
public interface SQLInput |
public interface SQLInput |
54 |
{ |
{ |
55 |
|
/** |
56 |
/*************************************************************************/ |
* This method reads the next item from the stream a Java |
57 |
|
* <code>String</code>. |
58 |
/** |
* |
59 |
* This method reads the next item from the stream a Java |
* @return The value read from the stream as a <code>String</code>. |
60 |
* <code>String</code>. |
* @exception SQLException If an error occurs. |
61 |
* |
*/ |
62 |
* @return The value read from the stream as a <code>String</code>. |
public String readString() throws SQLException; |
63 |
* |
|
64 |
* @exception SQLException If an error occurs. |
/** |
65 |
*/ |
* This method reads the next item from the stream a Java |
66 |
public abstract String |
* <code>boolean</code>. |
67 |
readString() throws SQLException; |
* |
68 |
|
* @return The value read from the stream as a <code>boolean</code>. |
69 |
/*************************************************************************/ |
* @exception SQLException If an error occurs. |
70 |
|
*/ |
71 |
/** |
public boolean readBoolean() throws SQLException; |
72 |
* This method reads the next item from the stream a Java |
|
73 |
* <code>boolean</code>. |
/** |
74 |
* |
* This method reads the next item from the stream a Java |
75 |
* @return The value read from the stream as a <code>boolean</code>. |
* <code>byte</code>. |
76 |
* |
* |
77 |
* @exception SQLException If an error occurs. |
* @return The value read from the stream as a <code>byte</code>. |
78 |
*/ |
* @exception SQLException If an error occurs. |
79 |
public abstract boolean |
*/ |
80 |
readBoolean() throws SQLException; |
public byte readByte() throws SQLException; |
81 |
|
|
82 |
/*************************************************************************/ |
/** |
83 |
|
* This method reads the next item from the stream a Java |
84 |
/** |
* <code>short</code>. |
85 |
* This method reads the next item from the stream a Java |
* |
86 |
* <code>byte</code>. |
* @return The value read from the stream as a <code>short</code>. |
87 |
* |
* @exception SQLException If an error occurs. |
88 |
* @return The value read from the stream as a <code>byte</code>. |
*/ |
89 |
* |
public short readShort() throws SQLException; |
90 |
* @exception SQLException If an error occurs. |
|
91 |
*/ |
/** |
92 |
public abstract byte |
* This method reads the next item from the stream a Java |
93 |
readByte() throws SQLException; |
* <code>int</code>. |
94 |
|
* |
95 |
/*************************************************************************/ |
* @return The value read from the stream as an <code>int</code>. |
96 |
|
* @exception SQLException If an error occurs. |
97 |
/** |
*/ |
98 |
* This method reads the next item from the stream a Java |
public int readInt() throws SQLException; |
99 |
* <code>short</code>. |
|
100 |
* |
/** |
101 |
* @return The value read from the stream as a <code>short</code>. |
* This method reads the next item from the stream a Java |
102 |
* |
* <code>long</code>. |
103 |
* @exception SQLException If an error occurs. |
* |
104 |
*/ |
* @return The value read from the stream as a <code>long</code>. |
105 |
public abstract short |
* @exception SQLException If an error occurs. |
106 |
readShort() throws SQLException; |
*/ |
107 |
|
public long readLong() throws SQLException; |
108 |
/*************************************************************************/ |
|
109 |
|
/** |
110 |
/** |
* This method reads the next item from the stream a Java |
111 |
* This method reads the next item from the stream a Java |
* <code>float</code>. |
112 |
* <code>int</code>. |
* |
113 |
* |
* @return The value read from the stream as a <code>float</code>. |
114 |
* @return The value read from the stream as an <code>int</code>. |
* @exception SQLException If an error occurs. |
115 |
* |
*/ |
116 |
* @exception SQLException If an error occurs. |
public float readFloat() throws SQLException; |
117 |
*/ |
|
118 |
public abstract int |
/** |
119 |
readInt() throws SQLException; |
* This method reads the next item from the stream a Java |
120 |
|
* <code>double</code>. |
121 |
/*************************************************************************/ |
* |
122 |
|
* @return The value read from the stream as a <code>double</code>. |
123 |
/** |
* @exception SQLException If an error occurs. |
124 |
* This method reads the next item from the stream a Java |
*/ |
125 |
* <code>long</code>. |
public double readDouble() throws SQLException; |
126 |
* |
|
127 |
* @return The value read from the stream as a <code>long</code>. |
/** |
128 |
* |
* This method reads the next item from the stream a Java |
129 |
* @exception SQLException If an error occurs. |
* <code>BigDecimal</code>. |
130 |
*/ |
* |
131 |
public abstract long |
* @return The value read from the stream as a <code>BigDecimal</code>. |
132 |
readLong() throws SQLException; |
* @exception SQLException If an error occurs. |
133 |
|
*/ |
134 |
/*************************************************************************/ |
public BigDecimal readBigDecimal() throws SQLException; |
135 |
|
|
136 |
/** |
/** |
137 |
* This method reads the next item from the stream a Java |
* This method reads the next item from the stream a Java |
138 |
* <code>float</code>. |
* byte array |
139 |
* |
* |
140 |
* @return The value read from the stream as a <code>float</code>. |
* @return The value read from the stream as a byte array. |
141 |
* |
* @exception SQLException If an error occurs. |
142 |
* @exception SQLException If an error occurs. |
*/ |
143 |
*/ |
public byte[] readBytes() throws SQLException; |
144 |
public abstract float |
|
145 |
readFloat() throws SQLException; |
/** |
146 |
|
* This method reads the next item from the stream a Java |
147 |
/*************************************************************************/ |
* <code>java.sql.Date</code>. |
148 |
|
* |
149 |
/** |
* @return The value read from the stream as a <code>java.sql.Date</code>. |
150 |
* This method reads the next item from the stream a Java |
* @exception SQLException If an error occurs. |
151 |
* <code>double</code>. |
*/ |
152 |
* |
public Date readDate() throws SQLException; |
153 |
* @return The value read from the stream as a <code>double</code>. |
|
154 |
* |
/** |
155 |
* @exception SQLException If an error occurs. |
* This method reads the next item from the stream a Java |
156 |
*/ |
* <code>java.sql.Time</code>. |
157 |
public abstract double |
* |
158 |
readDouble() throws SQLException; |
* @return The value read from the stream as a <code>java.sql.Time</code>. |
159 |
|
* @exception SQLException If an error occurs. |
160 |
/*************************************************************************/ |
*/ |
161 |
|
public Time readTime() throws SQLException; |
162 |
/** |
|
163 |
* This method reads the next item from the stream a Java |
/** |
164 |
* <code>BigDecimal</code>. |
* This method reads the next item from the stream a Java |
165 |
* |
* <code>java.sql.Timestamp</code>. |
166 |
* @return The value read from the stream as a <code>BigDecimal</code>. |
* |
167 |
* |
* @return The value read from the stream as a <code>java.sql.Timestamp</code>. |
168 |
* @exception SQLException If an error occurs. |
* @exception SQLException If an error occurs. |
169 |
*/ |
*/ |
170 |
public abstract BigDecimal |
public Timestamp readTimestamp() throws SQLException; |
171 |
readBigDecimal() throws SQLException; |
|
172 |
|
/** |
173 |
/*************************************************************************/ |
* This method reads the next item from the stream a character |
174 |
|
* <code>Reader</code>. |
175 |
/** |
* |
176 |
* This method reads the next item from the stream a Java |
* @return The value read from the stream as a <code>Reader</code>. |
177 |
* byte array |
* @exception SQLException If an error occurs. |
178 |
* |
*/ |
179 |
* @return The value read from the stream as a byte array. |
public Reader readCharacterStream() throws SQLException; |
180 |
* |
|
181 |
* @exception SQLException If an error occurs. |
/** |
182 |
*/ |
* This method reads the next item from the stream a ASCII text |
183 |
public abstract byte[] |
* <code>InputStream</code>. |
184 |
readBytes() throws SQLException; |
* |
185 |
|
* @return The value read from the stream as an <code>InputStream</code>. |
186 |
/*************************************************************************/ |
* @exception SQLException If an error occurs. |
187 |
|
*/ |
188 |
/** |
public InputStream readAsciiStream() throws SQLException; |
189 |
* This method reads the next item from the stream a Java |
|
190 |
* <code>java.sql.Date</code>. |
/** |
191 |
* |
* This method reads the next item from the stream a binary |
192 |
* @return The value read from the stream as a <code>java.sql.Date</code>. |
* <code>InputStream</code>. |
193 |
* |
* |
194 |
* @exception SQLException If an error occurs. |
* @return The value read from the stream as an <code>InputStream</code>. |
195 |
*/ |
* @exception SQLException If an error occurs. |
196 |
public abstract java.sql.Date |
*/ |
197 |
readDate() throws SQLException; |
public InputStream readBinaryStream() throws SQLException; |
198 |
|
|
199 |
/*************************************************************************/ |
/** |
200 |
|
* This method reads the next item from the stream a Java |
201 |
/** |
* <code>Object</code>. |
202 |
* This method reads the next item from the stream a Java |
* |
203 |
* <code>java.sql.Time</code>. |
* @return The value read from the stream as an <code>Object</code>. |
204 |
* |
* @exception SQLException If an error occurs. |
205 |
* @return The value read from the stream as a <code>java.sql.Time</code>. |
*/ |
206 |
* |
public Object readObject() throws SQLException; |
207 |
* @exception SQLException If an error occurs. |
|
208 |
*/ |
/** |
209 |
public abstract java.sql.Time |
* This method reads the next item from the stream a Java SQL |
210 |
readTime() throws SQLException; |
* <code>Ref</code>. |
211 |
|
* |
212 |
/*************************************************************************/ |
* @return The value read from the stream as an <code>Ref</code>. |
213 |
|
* @exception SQLException If an error occurs. |
214 |
/** |
*/ |
215 |
* This method reads the next item from the stream a Java |
public Ref readRef() throws SQLException; |
216 |
* <code>java.sql.Timestamp</code>. |
|
217 |
* |
/** |
218 |
* @return The value read from the stream as a <code>java.sql.Timestamp</code>. |
* This method reads the next item from the stream a Java SQL |
219 |
* |
* <code>Blob</code>. |
220 |
* @exception SQLException If an error occurs. |
* |
221 |
*/ |
* @return The value read from the stream as a <code>Blob</code>. |
222 |
public abstract java.sql.Timestamp |
* @exception SQLException If an error occurs. |
223 |
readTimestamp() throws SQLException; |
*/ |
224 |
|
public Blob readBlob() throws SQLException; |
225 |
/*************************************************************************/ |
|
226 |
|
/** |
227 |
/** |
* This method reads the next item from the stream a Java SQL |
228 |
* This method reads the next item from the stream a ASCII text |
* <code>Clob</code>. |
229 |
* <code>InputStream</code>. |
* |
230 |
* |
* @return The value read from the stream as a <code>Clob</code>. |
231 |
* @return The value read from the stream as an <code>InputStream</code>. |
* @exception SQLException If an error occurs. |
232 |
* |
*/ |
233 |
* @exception SQLException If an error occurs. |
public Clob readClob() throws SQLException; |
234 |
*/ |
|
235 |
public abstract InputStream |
/** |
236 |
readAsciiStream() throws SQLException; |
* This method reads the next item from the stream a Java SQL |
237 |
|
* <code>Array</code>. |
238 |
/*************************************************************************/ |
* |
239 |
|
* @return The value read from the stream as an <code>Array</code>. |
240 |
/** |
* @exception SQLException If an error occurs. |
241 |
* This method reads the next item from the stream a binary |
*/ |
242 |
* <code>InputStream</code>. |
public Array readArray() throws SQLException; |
243 |
* |
|
244 |
* @return The value read from the stream as an <code>InputStream</code>. |
/** |
245 |
* |
* This method tests whether or not the last value read was a SQL |
246 |
* @exception SQLException If an error occurs. |
* NULL value. |
247 |
*/ |
* |
248 |
public abstract InputStream |
* @return <code>true</code> if the last value read was a NULL, |
249 |
readBinaryStream() throws SQLException; |
* <code>false</code> otherwise. |
250 |
|
* @exception SQLException If an error occurs. |
251 |
/*************************************************************************/ |
*/ |
252 |
|
public boolean wasNull() throws SQLException; |
253 |
/** |
|
254 |
* This method reads the next item from the stream a character |
/** |
255 |
* <code>Reader</code>. |
* @since 1.4 |
256 |
* |
*/ |
257 |
* @return The value read from the stream as a <code>Reader</code>. |
public URL readURL() throws SQLException; |
258 |
* |
} |
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Reader |
|
|
readCharacterStream() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method reads the next item from the stream a Java |
|
|
* <code>Object</code>. |
|
|
* |
|
|
* @return The value read from the stream as an <code>Object</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Object |
|
|
readObject() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method reads the next item from the stream a Java SQL |
|
|
* <code>Ref</code>. |
|
|
* |
|
|
* @return The value read from the stream as an <code>Ref</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Ref |
|
|
readRef() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method reads the next item from the stream a Java SQL |
|
|
* <code>Blob</code>. |
|
|
* |
|
|
* @return The value read from the stream as a <code>Blob</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Blob |
|
|
readBlob() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method reads the next item from the stream a Java SQL |
|
|
* <code>Clob</code>. |
|
|
* |
|
|
* @return The value read from the stream as a <code>Clob</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Clob |
|
|
readClob() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method reads the next item from the stream a Java SQL |
|
|
* <code>Array</code>. |
|
|
* |
|
|
* @return The value read from the stream as an <code>Array</code>. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract Array |
|
|
readArray() throws SQLException; |
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
/** |
|
|
* This method tests whether or not the last value read was a SQL |
|
|
* NULL value. |
|
|
* |
|
|
* @return <code>true</code> if the last value read was a NULL, |
|
|
* <code>false</code> otherwise. |
|
|
* |
|
|
* @exception SQLException If an error occurs. |
|
|
*/ |
|
|
public abstract boolean |
|
|
wasNull() throws SQLException; |
|
|
|
|
|
} // interface SQLInput |
|
259 |
|
|