| 1 | /* Array.java -- Interface for accessing SQL array object
|
|---|
| 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.util.Map;
|
|---|
| 42 |
|
|---|
| 43 | /**
|
|---|
| 44 | * This interface provides methods for accessing SQL array types
|
|---|
| 45 | *
|
|---|
| 46 | * @author Aaron M. Renn ([email protected])
|
|---|
| 47 | */
|
|---|
| 48 | public interface Array
|
|---|
| 49 | {
|
|---|
| 50 |
|
|---|
| 51 | /**
|
|---|
| 52 | * This method returns the name of the SQL type of the elements in this
|
|---|
| 53 | * array. This name is database specific.
|
|---|
| 54 | *
|
|---|
| 55 | * @param The name of the SQL type of the elements in this array.
|
|---|
| 56 | *
|
|---|
| 57 | * @exception SQLException If an error occurs.
|
|---|
| 58 | */
|
|---|
| 59 | public abstract String
|
|---|
| 60 | getBaseTypeName() throws SQLException;
|
|---|
| 61 |
|
|---|
| 62 | /*************************************************************************/
|
|---|
| 63 |
|
|---|
| 64 | /**
|
|---|
| 65 | * This method returns the JDBC type identifier of the elements in this
|
|---|
| 66 | * array. This will be one of the values defined in the <code>Types</code>
|
|---|
| 67 | * class.
|
|---|
| 68 | *
|
|---|
| 69 | * @return The JDBC type of the elements in this array.
|
|---|
| 70 | *
|
|---|
| 71 | * @exception SQLException If an error occurs.
|
|---|
| 72 | *
|
|---|
| 73 | * @see Types
|
|---|
| 74 | */
|
|---|
| 75 | public abstract int
|
|---|
| 76 | getBaseType() throws SQLException;
|
|---|
| 77 |
|
|---|
| 78 | /*************************************************************************/
|
|---|
| 79 |
|
|---|
| 80 | /**
|
|---|
| 81 | * This method returns the contents of this array. This object returned
|
|---|
| 82 | * will be an array of Java objects of the appropriate types.
|
|---|
| 83 | *
|
|---|
| 84 | * @return The contents of the array as an array of Java objects.
|
|---|
| 85 | *
|
|---|
| 86 | * @exception SQLException If an error occurs.
|
|---|
| 87 | */
|
|---|
| 88 | public abstract Object
|
|---|
| 89 | getArray() throws SQLException;
|
|---|
| 90 |
|
|---|
| 91 | /*************************************************************************/
|
|---|
| 92 |
|
|---|
| 93 | /**
|
|---|
| 94 | * This method returns the contents of this array. The specified
|
|---|
| 95 | * <code>Map</code> will be used to override selected mappings between
|
|---|
| 96 | * SQL types and Java classes.
|
|---|
| 97 | *
|
|---|
| 98 | * @param map A mapping of SQL types to Java classes.
|
|---|
| 99 | *
|
|---|
| 100 | * @return The contents of the array as an array of Java objects.
|
|---|
| 101 | *
|
|---|
| 102 | * @exception SQLException If an error occurs.
|
|---|
| 103 | */
|
|---|
| 104 | public abstract Object
|
|---|
| 105 | getArray(Map map) throws SQLException;
|
|---|
| 106 |
|
|---|
| 107 | /*************************************************************************/
|
|---|
| 108 |
|
|---|
| 109 | /**
|
|---|
| 110 | * This method returns a portion of this array starting at index
|
|---|
| 111 | * <code>offset</code> into the array and continuing for <code>length</code>
|
|---|
| 112 | * elements. Fewer than the requested number of elements will be
|
|---|
| 113 | * returned if the array does not contain the requested number of elements.
|
|---|
| 114 | * The object returned will be an array of Java objects of
|
|---|
| 115 | * the appropriate types.
|
|---|
| 116 | *
|
|---|
| 117 | * @param offset The offset into this array to start returning elements from.
|
|---|
| 118 | * @param count The requested number of elements to return.
|
|---|
| 119 | *
|
|---|
| 120 | * @return The requested portion of the array.
|
|---|
| 121 | *
|
|---|
| 122 | * @exception SQLException If an error occurs.
|
|---|
| 123 | */
|
|---|
| 124 | public abstract Object
|
|---|
| 125 | getArray(long offset, int count) throws SQLException;
|
|---|
| 126 |
|
|---|
| 127 | /*************************************************************************/
|
|---|
| 128 |
|
|---|
| 129 | /**
|
|---|
| 130 | * This method returns a portion of this array starting at index
|
|---|
| 131 | * <code>offset</code> into the array and continuing for <code>length</code>
|
|---|
| 132 | * elements. Fewer than the requested number of elements will be
|
|---|
| 133 | * returned if the array does not contain the requested number of elements.
|
|---|
| 134 | * The object returned will be an array of Java objects. The specified
|
|---|
| 135 | * <code>Map</code> will be used for overriding selected SQL type to
|
|---|
| 136 | * Java class mappings.
|
|---|
| 137 | *
|
|---|
| 138 | * @param offset The offset into this array to start returning elements from.
|
|---|
| 139 | * @param count The requested number of elements to return.
|
|---|
| 140 | * @param map A mapping of SQL types to Java classes.
|
|---|
| 141 | *
|
|---|
| 142 | * @return The requested portion of the array.
|
|---|
| 143 | *
|
|---|
| 144 | * @exception SQLException If an error occurs.
|
|---|
| 145 | */
|
|---|
| 146 | public abstract Object
|
|---|
| 147 | getArray(long index, int count, Map map) throws SQLException;
|
|---|
| 148 |
|
|---|
| 149 | /*************************************************************************/
|
|---|
| 150 |
|
|---|
| 151 | /**
|
|---|
| 152 | * This method returns the elements in the array as a <code>ResultSet</code>.
|
|---|
| 153 | * Each row of the result set will have two columns. The first will be
|
|---|
| 154 | * the index into the array of that row's contents. The second will be
|
|---|
| 155 | * the actual value of that array element.
|
|---|
| 156 | *
|
|---|
| 157 | * @return The elements of this array as a <code>ResultSet</code>.
|
|---|
| 158 | *
|
|---|
| 159 | * @exception SQLException If an error occurs.
|
|---|
| 160 | *
|
|---|
| 161 | * @see ResultSet
|
|---|
| 162 | */
|
|---|
| 163 | public abstract ResultSet
|
|---|
| 164 | getResultSet() throws SQLException;
|
|---|
| 165 |
|
|---|
| 166 | /*************************************************************************/
|
|---|
| 167 |
|
|---|
| 168 | /**
|
|---|
| 169 | * This method returns the elements in the array as a <code>ResultSet</code>.
|
|---|
| 170 | * Each row of the result set will have two columns. The first will be
|
|---|
| 171 | * the index into the array of that row's contents. The second will be
|
|---|
| 172 | * the actual value of that array element. The specified <code>Map</code>
|
|---|
| 173 | * will be used to override selected default mappings of SQL types to
|
|---|
| 174 | * Java classes.
|
|---|
| 175 | *
|
|---|
| 176 | * @param map A mapping of SQL types to Java classes.
|
|---|
| 177 | *
|
|---|
| 178 | * @return The elements of this array as a <code>ResultSet</code>.
|
|---|
| 179 | *
|
|---|
| 180 | * @exception SQLException If an error occurs.
|
|---|
| 181 | *
|
|---|
| 182 | * @see ResultSet
|
|---|
| 183 | */
|
|---|
| 184 | public abstract ResultSet
|
|---|
| 185 | getResultSet(Map map) throws SQLException;
|
|---|
| 186 |
|
|---|
| 187 | /*************************************************************************/
|
|---|
| 188 |
|
|---|
| 189 | /**
|
|---|
| 190 | * This method returns a portion of the array as a <code>ResultSet</code>.
|
|---|
| 191 | * The returned portion will start at index <code>offset</code> into the
|
|---|
| 192 | * array and up to <code>length</code> elements will be returned.
|
|---|
| 193 | * <p>
|
|---|
| 194 | * Each row of the result set will have two columns. The first will be
|
|---|
| 195 | * the index into the array of that row's contents. The second will be
|
|---|
| 196 | * the actual value of that array element.
|
|---|
| 197 | *
|
|---|
| 198 | * @param offset The index into the array to start returning elements from.
|
|---|
| 199 | * @param length The requested number of elements to return.
|
|---|
| 200 | *
|
|---|
| 201 | * @return The requested elements of this array as a <code>ResultSet</code>.
|
|---|
| 202 | *
|
|---|
| 203 | * @exception SQLException If an error occurs.
|
|---|
| 204 | *
|
|---|
| 205 | * @see ResultSet
|
|---|
| 206 | */
|
|---|
| 207 | public abstract ResultSet
|
|---|
| 208 | getResultSet(long index, int count) throws SQLException;
|
|---|
| 209 |
|
|---|
| 210 | /*************************************************************************/
|
|---|
| 211 |
|
|---|
| 212 | /**
|
|---|
| 213 | * This method returns a portion of the array as a <code>ResultSet</code>.
|
|---|
| 214 | * The returned portion will start at index <code>offset</code> into the
|
|---|
| 215 | * array and up to <code>length</code> elements will be returned.
|
|---|
| 216 | * <p>
|
|---|
| 217 | * Each row of the result set will have two columns. The first will be
|
|---|
| 218 | * the index into the array of that row's contents. The second will be
|
|---|
| 219 | * the actual value of that array element. The specified <code>Map</code>
|
|---|
| 220 | * will be used to override selected default mappings of SQL types to
|
|---|
| 221 | * Java classes.
|
|---|
| 222 | *
|
|---|
| 223 | * @param offset The index into the array to start returning elements from.
|
|---|
| 224 | * @param length The requested number of elements to return.
|
|---|
| 225 | * @param map A mapping of SQL types to Java classes.
|
|---|
| 226 | *
|
|---|
| 227 | * @return The requested elements of this array as a <code>ResultSet</code>.
|
|---|
| 228 | *
|
|---|
| 229 | * @exception SQLException If an error occurs.
|
|---|
| 230 | *
|
|---|
| 231 | * @see ResultSet
|
|---|
| 232 | */
|
|---|
| 233 | public abstract ResultSet
|
|---|
| 234 | getResultSet(long index, int count, Map map) throws SQLException;
|
|---|
| 235 |
|
|---|
| 236 | } // interface Array
|
|---|
| 237 |
|
|---|