1 | /* Array.java -- Interface for accessing SQL array object
|
---|
2 | Copyright (C) 1999, 2000, 2002 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 | package java.sql;
|
---|
39 |
|
---|
40 | import java.util.Map;
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * This interface provides methods for accessing SQL array types.
|
---|
44 | *
|
---|
45 | * @author Aaron M. Renn (arenn@urbanophile.com)
|
---|
46 | */
|
---|
47 | public interface Array
|
---|
48 | {
|
---|
49 | /**
|
---|
50 | * Returns the name of the SQL type of the elements in this
|
---|
51 | * array. This name is database specific.
|
---|
52 | *
|
---|
53 | * @param The name of the SQL type of the elements in this array.
|
---|
54 | * @exception SQLException If an error occurs.
|
---|
55 | */
|
---|
56 | public String getBaseTypeName() throws SQLException;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Returns the JDBC type identifier of the elements in this
|
---|
60 | * array. This will be one of the values defined in the
|
---|
61 | * <code>Types</code> class.
|
---|
62 | *
|
---|
63 | * @return The JDBC type of the elements in this array.
|
---|
64 | * @exception SQLException If an error occurs.
|
---|
65 | * @see Types
|
---|
66 | */
|
---|
67 | public int getBaseType() throws SQLException;
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Returns the contents of this array. This object returned
|
---|
71 | * will be an array of Java objects of the appropriate types.
|
---|
72 | *
|
---|
73 | * @return The contents of the array as an array of Java objects.
|
---|
74 | * @exception SQLException If an error occurs.
|
---|
75 | */
|
---|
76 | public Object getArray() throws SQLException;
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Returns the contents of this array. The specified
|
---|
80 | * <code>Map</code> will be used to override selected mappings
|
---|
81 | * between SQL types and Java classes.
|
---|
82 | *
|
---|
83 | * @param map A mapping of SQL types to Java classes.
|
---|
84 | * @return The contents of the array as an array of Java objects.
|
---|
85 | * @exception SQLException If an error occurs.
|
---|
86 | */
|
---|
87 | public Object getArray(Map map) throws SQLException;
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Returns a portion of this array starting at <code>index</code>
|
---|
91 | * into the array and continuing for <code>count</code>
|
---|
92 | * elements. Fewer than the requested number of elements will be
|
---|
93 | * returned if the array does not contain the requested number of elements.
|
---|
94 | * The object returned will be an array of Java objects of
|
---|
95 | * the appropriate types.
|
---|
96 | *
|
---|
97 | * @param offset The offset into this array to start returning elements from.
|
---|
98 | * @param count The requested number of elements to return.
|
---|
99 | * @return The requested portion of the array.
|
---|
100 | * @exception SQLException If an error occurs.
|
---|
101 | */
|
---|
102 | public Object getArray(long index, int count) throws SQLException;
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * This method returns a portion of this array starting at <code>index</code>
|
---|
106 | * into the array and continuing for <code>count</code>
|
---|
107 | * elements. Fewer than the requested number of elements will be
|
---|
108 | * returned if the array does not contain the requested number of elements.
|
---|
109 | * The object returned will be an array of Java objects. The specified
|
---|
110 | * <code>Map</code> will be used for overriding selected SQL type to
|
---|
111 | * Java class mappings.
|
---|
112 | *
|
---|
113 | * @param offset The offset into this array to start returning elements from.
|
---|
114 | * @param count The requested number of elements to return.
|
---|
115 | * @param map A mapping of SQL types to Java classes.
|
---|
116 | * @return The requested portion of the array.
|
---|
117 | * @exception SQLException If an error occurs.
|
---|
118 | */
|
---|
119 | public Object getArray(long index, int count, Map map) throws SQLException;
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Returns the elements in the array as a <code>ResultSet</code>.
|
---|
123 | * Each row of the result set will have two columns. The first will be
|
---|
124 | * the index into the array of that row's contents. The second will be
|
---|
125 | * the actual value of that array element.
|
---|
126 | *
|
---|
127 | * @return The elements of this array as a <code>ResultSet</code>.
|
---|
128 | * @exception SQLException If an error occurs.
|
---|
129 | * @see ResultSet
|
---|
130 | */
|
---|
131 | public ResultSet getResultSet() throws SQLException;
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * This method returns the elements in the array as a <code>ResultSet</code>.
|
---|
135 | * Each row of the result set will have two columns. The first will be
|
---|
136 | * the index into the array of that row's contents. The second will be
|
---|
137 | * the actual value of that array element. The specified <code>Map</code>
|
---|
138 | * will be used to override selected default mappings of SQL types to
|
---|
139 | * Java classes.
|
---|
140 | *
|
---|
141 | * @param map A mapping of SQL types to Java classes.
|
---|
142 | * @return The elements of this array as a <code>ResultSet</code>.
|
---|
143 | * @exception SQLException If an error occurs.
|
---|
144 | * @see ResultSet
|
---|
145 | */
|
---|
146 | public ResultSet getResultSet(Map map) throws SQLException;
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * This method returns a portion of the array as a <code>ResultSet</code>.
|
---|
150 | * The returned portion will start at <code>index</code> into the
|
---|
151 | * array and up to <code>count</code> elements will be returned.
|
---|
152 | * <p>
|
---|
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 | * @param offset The index into the array to start returning elements from.
|
---|
158 | * @param length The requested number of elements to return.
|
---|
159 | * @return The requested elements of this array as a <code>ResultSet</code>.
|
---|
160 | * @exception SQLException If an error occurs.
|
---|
161 | * @see ResultSet
|
---|
162 | */
|
---|
163 | public ResultSet getResultSet(long index, int count) throws SQLException;
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * This method returns a portion of the array as a <code>ResultSet</code>.
|
---|
167 | * The returned portion will start at <code>index</code> into the
|
---|
168 | * array and up to <cod>count</code> elements will be returned.
|
---|
169 | * <p>
|
---|
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 offset The index into the array to start returning elements from.
|
---|
177 | * @param length The requested number of elements to return.
|
---|
178 | * @param map A mapping of SQL types to Java classes.
|
---|
179 | * @return The requested elements of this array as a <code>ResultSet</code>.
|
---|
180 | * @exception SQLException If an error occurs.
|
---|
181 | * @see ResultSet
|
---|
182 | */
|
---|
183 | public ResultSet getResultSet(long index, int count, Map map)
|
---|
184 | throws SQLException;
|
---|
185 | }
|
---|