OSDN Git Service

Start of AWT merge with Classpath:
[pf3gnuchains/gcc-fork.git] / libjava / java / sql / Array.java
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 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
26
27
28 package java.sql;
29
30 import java.util.Map;
31
32 /**
33   * This interface provides methods for accessing SQL array types
34   *
35   * @author Aaron M. Renn (arenn@urbanophile.com)
36   */
37 public interface Array
38 {
39
40 /**
41   * This method returns the name of the SQL type of the elements in this
42   * array.  This name is database specific.
43   *
44   * @param The name of the SQL type of the elements in this array.
45   *
46   * @exception SQLException If an error occurs.
47   */
48 public abstract String
49 getBaseTypeName() throws SQLException;
50
51 /*************************************************************************/
52
53 /**
54   * This method returns the JDBC type identifier of the elements in this
55   * array.  This will be one of the values defined in the <code>Types</code>
56   * class.
57   *
58   * @return The JDBC type of the elements in this array.
59   *
60   * @exception SQLException If an error occurs.
61   * 
62   * @see Types
63   */
64 public abstract int
65 getBaseType() throws SQLException;
66
67 /*************************************************************************/
68
69 /**
70   * This method 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   *
75   * @exception SQLException If an error occurs.
76   */
77 public abstract Object
78 getArray() throws SQLException;
79
80 /*************************************************************************/
81
82 /**
83   * This method returns the contents of this array.  The specified
84   * <code>Map</code> will be used to override selected mappings between
85   * SQL types and Java classes.
86   * 
87   * @param map A mapping of SQL types to Java classes.
88   *
89   * @return The contents of the array as an array of Java objects.
90   *
91   * @exception SQLException If an error occurs.
92   */
93 public abstract Object
94 getArray(Map map) throws SQLException;
95
96 /*************************************************************************/
97
98 /**
99   * This method returns a portion of this array starting at index
100   * <code>offset</code> into the array and continuing for <code>length</code>
101   * elements.  Fewer than the requested number of elements will be
102   * returned if the array does not contain the requested number of elements.
103   * The object returned will be an array of Java objects of
104   * the appropriate types.
105   *
106   * @param offset The offset into this array to start returning elements from.
107   * @param count The requested number of elements to return.
108   *
109   * @return The requested portion of the array.
110   *
111   * @exception SQLException If an error occurs.
112   */
113 public abstract Object
114 getArray(long offset, int count) throws SQLException;
115
116 /*************************************************************************/
117
118 /**
119   * This method returns a portion of this array starting at index
120   * <code>offset</code> into the array and continuing for <code>length</code>
121   * elements.  Fewer than the requested number of elements will be
122   * returned if the array does not contain the requested number of elements.
123   * The object returned will be an array of Java objects.  The specified
124   * <code>Map</code> will be used for overriding selected SQL type to
125   * Java class mappings.
126   *
127   * @param offset The offset into this array to start returning elements from.
128   * @param count The requested number of elements to return.
129   * @param map A mapping of SQL types to Java classes.
130   *
131   * @return The requested portion of the array.
132   *
133   * @exception SQLException If an error occurs.
134   */
135 public abstract Object
136 getArray(long index, int count, Map map) throws SQLException;
137
138 /*************************************************************************/
139
140 /**
141   * This method returns the elements in the array as a <code>ResultSet</code>.
142   * Each row of the result set will have two columns.  The first will be
143   * the index into the array of that row's contents.  The second will be
144   * the actual value of that array element.
145   *
146   * @return The elements of this array as a <code>ResultSet</code>.
147   *
148   * @exception SQLException If an error occurs.
149   *
150   * @see ResultSet
151   */
152 public abstract ResultSet
153 getResultSet() throws SQLException;
154
155 /*************************************************************************/
156
157 /**
158   * This method returns the elements in the array as a <code>ResultSet</code>.
159   * Each row of the result set will have two columns.  The first will be
160   * the index into the array of that row's contents.  The second will be
161   * the actual value of that array element.  The specified <code>Map</code>
162   * will be used to override selected default mappings of SQL types to
163   * Java classes.
164   *
165   * @param map A mapping of SQL types to Java classes.
166   *
167   * @return The elements of this array as a <code>ResultSet</code>.
168   *
169   * @exception SQLException If an error occurs.
170   *
171   * @see ResultSet
172   */
173 public abstract ResultSet
174 getResultSet(Map map) throws SQLException;
175
176 /*************************************************************************/
177
178 /**
179   * This method returns a portion of the array as a <code>ResultSet</code>.
180   * The returned portion will start at index <code>offset</code> into the
181   * array and up to <code>length</code> elements will be returned.
182   * <p>
183   * Each row of the result set will have two columns.  The first will be
184   * the index into the array of that row's contents.  The second will be
185   * the actual value of that array element.
186   *
187   * @param offset The index into the array to start returning elements from.
188   * @param length The requested number of elements to return.
189   *
190   * @return The requested elements of this array as a <code>ResultSet</code>.
191   *
192   * @exception SQLException If an error occurs.
193   *
194   * @see ResultSet
195   */
196 public abstract ResultSet
197 getResultSet(long index, int count) throws SQLException;
198
199 /*************************************************************************/
200
201 /**
202   * This method returns a portion of the array as a <code>ResultSet</code>.
203   * The returned portion will start at index <code>offset</code> into the
204   * array and up to <code>length</code> elements will be returned.
205   * <p>
206   * Each row of the result set will have two columns.  The first will be
207   * the index into the array of that row's contents.  The second will be
208   * the actual value of that array element.  The specified <code>Map</code>
209   * will be used to override selected default mappings of SQL types to
210   * Java classes.
211   *
212   * @param offset The index into the array to start returning elements from.
213   * @param length The requested number of elements to return.
214   * @param map A mapping of SQL types to Java classes.
215   *
216   * @return The requested elements of this array as a <code>ResultSet</code>.
217   *
218   * @exception SQLException If an error occurs.
219   *
220   * @see ResultSet
221   */
222 public abstract ResultSet
223 getResultSet(long index, int count, Map map) throws SQLException;
224
225 } // interface Array
226