KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > fetch > FetchResult


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdbc.fetch;
13
14 import java.util.Iterator JavaDoc;
15 import java.sql.PreparedStatement JavaDoc;
16
17 /**
18  * This provides access to the results of a FetchSpec query.
19  */

20 public interface FetchResult extends Iterator JavaDoc {
21
22     /**
23      * Execute the query for these results.
24      */

25     public void execute();
26
27     /**
28      * If this query is busy executing then call cancel on its
29      * PreparedStatement. Otherwise do nothing.
30      */

31     public void cancel();
32
33     /**
34      * Close these results, discarding any exceptions. It is a NOP to call
35      * close on an already closed result.
36      */

37     public void close();
38
39     /**
40      * Has this result been closed?
41      */

42     public boolean isClosed();
43
44     /**
45      * Are there more results? This will execute the query if not already
46      * done. It returns false if the results have been closed. The results
47      * are automatically closed if there are no more results.
48      */

49     public boolean hasNext();
50
51     /**
52      * Return an Object[] or a Object depending on the spec. Throws a
53      * JDOFatalInternalException if there are no more rows or the results
54      * have been closed.
55      */

56     public Object JavaDoc next();
57
58     /**
59      * Remove is not supported.
60      */

61     public void remove();
62
63     /**
64      * Is this a scrollable result? If true then get(index) can be used to
65      * access the rows.
66      */

67     public boolean isScrollable();
68
69     /**
70      * Return the number of results. This is only valid for a scrollable
71      * result. This will execute the query if not already done.
72      */

73     public int size();
74
75     /**
76      * Return the row at index (zero based). This is only valid for a
77      * scrollable result. This will execute the query if not already done.
78      */

79     public Object JavaDoc get(int index);
80
81     /**
82      * Get the FetchSpec we were created from. This provides state information
83      * e.g. the type of each entry in the projection.
84      */

85     public FetchSpec getFetchSpec();
86
87     /**
88      * Todo remove this hack for EJBQL when we refactor query stuff
89      */

90     public PreparedStatement JavaDoc getPreparedStatement();
91 }
92
93
Popular Tags