| 1 | /* SQLInput.java -- Read SQL values from a stream
|
|---|
| 2 | Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU General Public License as published by
|
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | any later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 19 | 02111-1307 USA.
|
|---|
| 20 |
|
|---|
| 21 | Linking this library statically or dynamically with other modules is
|
|---|
| 22 | making a combined work based on this library. Thus, the terms and
|
|---|
| 23 | conditions of the GNU General Public License cover the whole
|
|---|
| 24 | combination.
|
|---|
| 25 |
|
|---|
| 26 | As a special exception, the copyright holders of this library give you
|
|---|
| 27 | permission to link this library with independent modules to produce an
|
|---|
| 28 | executable, regardless of the license terms of these independent
|
|---|
| 29 | modules, and to copy and distribute the resulting executable under
|
|---|
| 30 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 31 | independent module, the terms and conditions of the license of that
|
|---|
| 32 | module. An independent module is a module which is not derived from
|
|---|
| 33 | or based on this library. If you modify this library, you may extend
|
|---|
| 34 | this exception to your version of the library, but you are not
|
|---|
| 35 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 36 | exception statement from your version. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package java.sql;
|
|---|
| 40 |
|
|---|
| 41 | import java.io.InputStream;
|
|---|
| 42 | import java.io.Reader;
|
|---|
| 43 | import java.math.BigDecimal;
|
|---|
| 44 |
|
|---|
| 45 | /**
|
|---|
| 46 | * This interface provides methods for reading values from a stream
|
|---|
| 47 | * that is connected to a SQL structured or distinct type. It is used
|
|---|
| 48 | * for custom mapping of user defined data types.
|
|---|
| 49 | *
|
|---|
| 50 | * @author Aaron M. Renn ([email protected])
|
|---|
| 51 | */
|
|---|
| 52 | public interface SQLInput
|
|---|
| 53 | {
|
|---|
| 54 |
|
|---|
| 55 | /*************************************************************************/
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | * This method reads the next item from the stream a Java
|
|---|
| 59 | * <code>String</code>.
|
|---|
| 60 | *
|
|---|
| 61 | * @return The value read from the stream as a <code>String</code>.
|
|---|
| 62 | *
|
|---|
| 63 | * @exception SQLException If an error occurs.
|
|---|
| 64 | */
|
|---|
| 65 | public abstract String
|
|---|
| 66 | readString() throws SQLException;
|
|---|
| 67 |
|
|---|
| 68 | /*************************************************************************/
|
|---|
| 69 |
|
|---|
| 70 | /**
|
|---|
| 71 | * This method reads the next item from the stream a Java
|
|---|
| 72 | * <code>boolean</code>.
|
|---|
| 73 | *
|
|---|
| 74 | * @return The value read from the stream as a <code>boolean</code>.
|
|---|
| 75 | *
|
|---|
| 76 | * @exception SQLException If an error occurs.
|
|---|
| 77 | */
|
|---|
| 78 | public abstract boolean
|
|---|
| 79 | readBoolean() throws SQLException;
|
|---|
| 80 |
|
|---|
| 81 | /*************************************************************************/
|
|---|
| 82 |
|
|---|
| 83 | /**
|
|---|
| 84 | * This method reads the next item from the stream a Java
|
|---|
| 85 | * <code>byte</code>.
|
|---|
| 86 | *
|
|---|
| 87 | * @return The value read from the stream as a <code>byte</code>.
|
|---|
| 88 | *
|
|---|
| 89 | * @exception SQLException If an error occurs.
|
|---|
| 90 | */
|
|---|
| 91 | public abstract byte
|
|---|
| 92 | readByte() throws SQLException;
|
|---|
| 93 |
|
|---|
| 94 | /*************************************************************************/
|
|---|
| 95 |
|
|---|
| 96 | /**
|
|---|
| 97 | * This method reads the next item from the stream a Java
|
|---|
| 98 | * <code>short</code>.
|
|---|
| 99 | *
|
|---|
| 100 | * @return The value read from the stream as a <code>short</code>.
|
|---|
| 101 | *
|
|---|
| 102 | * @exception SQLException If an error occurs.
|
|---|
| 103 | */
|
|---|
| 104 | public abstract short
|
|---|
| 105 | readShort() throws SQLException;
|
|---|
| 106 |
|
|---|
| 107 | /*************************************************************************/
|
|---|
| 108 |
|
|---|
| 109 | /**
|
|---|
| 110 | * This method reads the next item from the stream a Java
|
|---|
| 111 | * <code>int</code>.
|
|---|
| 112 | *
|
|---|
| 113 | * @return The value read from the stream as an <code>int</code>.
|
|---|
| 114 | *
|
|---|
| 115 | * @exception SQLException If an error occurs.
|
|---|
| 116 | */
|
|---|
| 117 | public abstract int
|
|---|
| 118 | readInt() throws SQLException;
|
|---|
| 119 |
|
|---|
| 120 | /*************************************************************************/
|
|---|
| 121 |
|
|---|
| 122 | /**
|
|---|
| 123 | * This method reads the next item from the stream a Java
|
|---|
| 124 | * <code>long</code>.
|
|---|
| 125 | *
|
|---|
| 126 | * @return The value read from the stream as a <code>long</code>.
|
|---|
| 127 | *
|
|---|
| 128 | * @exception SQLException If an error occurs.
|
|---|
| 129 | */
|
|---|
| 130 | public abstract long
|
|---|
| 131 | readLong() throws SQLException;
|
|---|
| 132 |
|
|---|
| 133 | /*************************************************************************/
|
|---|
| 134 |
|
|---|
| 135 | /**
|
|---|
| 136 | * This method reads the next item from the stream a Java
|
|---|
| 137 | * <code>float</code>.
|
|---|
| 138 | *
|
|---|
| 139 | * @return The value read from the stream as a <code>float</code>.
|
|---|
| 140 | *
|
|---|
| 141 | * @exception SQLException If an error occurs.
|
|---|
| 142 | */
|
|---|
| 143 | public abstract float
|
|---|
| 144 | readFloat() throws SQLException;
|
|---|
| 145 |
|
|---|
| 146 | /*************************************************************************/
|
|---|
| 147 |
|
|---|
| 148 | /**
|
|---|
| 149 | * This method reads the next item from the stream a Java
|
|---|
| 150 | * <code>double</code>.
|
|---|
| 151 | *
|
|---|
| 152 | * @return The value read from the stream as a <code>double</code>.
|
|---|
| 153 | *
|
|---|
| 154 | * @exception SQLException If an error occurs.
|
|---|
| 155 | */
|
|---|
| 156 | public abstract double
|
|---|
| 157 | readDouble() throws SQLException;
|
|---|
| 158 |
|
|---|
| 159 | /*************************************************************************/
|
|---|
| 160 |
|
|---|
| 161 | /**
|
|---|
| 162 | * This method reads the next item from the stream a Java
|
|---|
| 163 | * <code>BigDecimal</code>.
|
|---|
| 164 | *
|
|---|
| 165 | * @return The value read from the stream as a <code>BigDecimal</code>.
|
|---|
| 166 | *
|
|---|
| 167 | * @exception SQLException If an error occurs.
|
|---|
| 168 | */
|
|---|
| 169 | public abstract BigDecimal
|
|---|
| 170 | readBigDecimal() throws SQLException;
|
|---|
| 171 |
|
|---|
| 172 | /*************************************************************************/
|
|---|
| 173 |
|
|---|
| 174 | /**
|
|---|
| 175 | * This method reads the next item from the stream a Java
|
|---|
| 176 | * byte array
|
|---|
| 177 | *
|
|---|
| 178 | * @return The value read from the stream as a byte array.
|
|---|
| 179 | *
|
|---|
| 180 | * @exception SQLException If an error occurs.
|
|---|
| 181 | */
|
|---|
| 182 | public abstract byte[]
|
|---|
| 183 | readBytes() throws SQLException;
|
|---|
| 184 |
|
|---|
| 185 | /*************************************************************************/
|
|---|
| 186 |
|
|---|
| 187 | /**
|
|---|
| 188 | * This method reads the next item from the stream a Java
|
|---|
| 189 | * <code>java.sql.Date</code>.
|
|---|
| 190 | *
|
|---|
| 191 | * @return The value read from the stream as a <code>java.sql.Date</code>.
|
|---|
| 192 | *
|
|---|
| 193 | * @exception SQLException If an error occurs.
|
|---|
| 194 | */
|
|---|
| 195 | public abstract java.sql.Date
|
|---|
| 196 | readDate() throws SQLException;
|
|---|
| 197 |
|
|---|
| 198 | /*************************************************************************/
|
|---|
| 199 |
|
|---|
| 200 | /**
|
|---|
| 201 | * This method reads the next item from the stream a Java
|
|---|
| 202 | * <code>java.sql.Time</code>.
|
|---|
| 203 | *
|
|---|
| 204 | * @return The value read from the stream as a <code>java.sql.Time</code>.
|
|---|
| 205 | *
|
|---|
| 206 | * @exception SQLException If an error occurs.
|
|---|
| 207 | */
|
|---|
| 208 | public abstract java.sql.Time
|
|---|
| 209 | readTime() throws SQLException;
|
|---|
| 210 |
|
|---|
| 211 | /*************************************************************************/
|
|---|
| 212 |
|
|---|
| 213 | /**
|
|---|
| 214 | * This method reads the next item from the stream a Java
|
|---|
| 215 | * <code>java.sql.Timestamp</code>.
|
|---|
| 216 | *
|
|---|
| 217 | * @return The value read from the stream as a <code>java.sql.Timestamp</code>.
|
|---|
| 218 | *
|
|---|
| 219 | * @exception SQLException If an error occurs.
|
|---|
| 220 | */
|
|---|
| 221 | public abstract java.sql.Timestamp
|
|---|
| 222 | readTimestamp() throws SQLException;
|
|---|
| 223 |
|
|---|
| 224 | /*************************************************************************/
|
|---|
| 225 |
|
|---|
| 226 | /**
|
|---|
| 227 | * This method reads the next item from the stream a ASCII text
|
|---|
| 228 | * <code>InputStream</code>.
|
|---|
| 229 | *
|
|---|
| 230 | * @return The value read from the stream as an <code>InputStream</code>.
|
|---|
| 231 | *
|
|---|
| 232 | * @exception SQLException If an error occurs.
|
|---|
| 233 | */
|
|---|
| 234 | public abstract InputStream
|
|---|
| 235 | readAsciiStream() throws SQLException;
|
|---|
| 236 |
|
|---|
| 237 | /*************************************************************************/
|
|---|
| 238 |
|
|---|
| 239 | /**
|
|---|
| 240 | * This method reads the next item from the stream a binary
|
|---|
| 241 | * <code>InputStream</code>.
|
|---|
| 242 | *
|
|---|
| 243 | * @return The value read from the stream as an <code>InputStream</code>.
|
|---|
| 244 | *
|
|---|
| 245 | * @exception SQLException If an error occurs.
|
|---|
| 246 | */
|
|---|
| 247 | public abstract InputStream
|
|---|
| 248 | readBinaryStream() throws SQLException;
|
|---|
| 249 |
|
|---|
| 250 | /*************************************************************************/
|
|---|
| 251 |
|
|---|
| 252 | /**
|
|---|
| 253 | * This method reads the next item from the stream a character
|
|---|
| 254 | * <code>Reader</code>.
|
|---|
| 255 | *
|
|---|
| 256 | * @return The value read from the stream as a <code>Reader</code>.
|
|---|
| 257 | *
|
|---|
| 258 | * @exception SQLException If an error occurs.
|
|---|
| 259 | */
|
|---|
| 260 | public abstract Reader
|
|---|
| 261 | readCharacterStream() throws SQLException;
|
|---|
| 262 |
|
|---|
| 263 | /*************************************************************************/
|
|---|
| 264 |
|
|---|
| 265 | /**
|
|---|
| 266 | * This method reads the next item from the stream a Java
|
|---|
| 267 | * <code>Object</code>.
|
|---|
| 268 | *
|
|---|
| 269 | * @return The value read from the stream as an <code>Object</code>.
|
|---|
| 270 | *
|
|---|
| 271 | * @exception SQLException If an error occurs.
|
|---|
| 272 | */
|
|---|
| 273 | public abstract Object
|
|---|
| 274 | readObject() throws SQLException;
|
|---|
| 275 |
|
|---|
| 276 | /*************************************************************************/
|
|---|
| 277 |
|
|---|
| 278 | /**
|
|---|
| 279 | * This method reads the next item from the stream a Java SQL
|
|---|
| 280 | * <code>Ref</code>.
|
|---|
| 281 | *
|
|---|
| 282 | * @return The value read from the stream as an <code>Ref</code>.
|
|---|
| 283 | *
|
|---|
| 284 | * @exception SQLException If an error occurs.
|
|---|
| 285 | */
|
|---|
| 286 | public abstract Ref
|
|---|
| 287 | readRef() throws SQLException;
|
|---|
| 288 |
|
|---|
| 289 | /*************************************************************************/
|
|---|
| 290 |
|
|---|
| 291 | /**
|
|---|
| 292 | * This method reads the next item from the stream a Java SQL
|
|---|
| 293 | * <code>Blob</code>.
|
|---|
| 294 | *
|
|---|
| 295 | * @return The value read from the stream as a <code>Blob</code>.
|
|---|
| 296 | *
|
|---|
| 297 | * @exception SQLException If an error occurs.
|
|---|
| 298 | */
|
|---|
| 299 | public abstract Blob
|
|---|
| 300 | readBlob() throws SQLException;
|
|---|
| 301 |
|
|---|
| 302 | /*************************************************************************/
|
|---|
| 303 |
|
|---|
| 304 | /**
|
|---|
| 305 | * This method reads the next item from the stream a Java SQL
|
|---|
| 306 | * <code>Clob</code>.
|
|---|
| 307 | *
|
|---|
| 308 | * @return The value read from the stream as a <code>Clob</code>.
|
|---|
| 309 | *
|
|---|
| 310 | * @exception SQLException If an error occurs.
|
|---|
| 311 | */
|
|---|
| 312 | public abstract Clob
|
|---|
| 313 | readClob() throws SQLException;
|
|---|
| 314 |
|
|---|
| 315 | /*************************************************************************/
|
|---|
| 316 |
|
|---|
| 317 | /**
|
|---|
| 318 | * This method reads the next item from the stream a Java SQL
|
|---|
| 319 | * <code>Array</code>.
|
|---|
| 320 | *
|
|---|
| 321 | * @return The value read from the stream as an <code>Array</code>.
|
|---|
| 322 | *
|
|---|
| 323 | * @exception SQLException If an error occurs.
|
|---|
| 324 | */
|
|---|
| 325 | public abstract Array
|
|---|
| 326 | readArray() throws SQLException;
|
|---|
| 327 |
|
|---|
| 328 | /*************************************************************************/
|
|---|
| 329 |
|
|---|
| 330 | /**
|
|---|
| 331 | * This method tests whether or not the last value read was a SQL
|
|---|
| 332 | * NULL value.
|
|---|
| 333 | *
|
|---|
| 334 | * @return <code>true</code> if the last value read was a NULL,
|
|---|
| 335 | * <code>false</code> otherwise.
|
|---|
| 336 | *
|
|---|
| 337 | * @exception SQLException If an error occurs.
|
|---|
| 338 | */
|
|---|
| 339 | public abstract boolean
|
|---|
| 340 | wasNull() throws SQLException;
|
|---|
| 341 |
|
|---|
| 342 | } // interface SQLInput
|
|---|
| 343 |
|
|---|