KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > xml > xdbc > XMLStatement


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.xml.xdbc;
24
25 /**
26  * This statement interface is used for executing constant XQuery or XPath statements
27  * and obtaining the results produced (update statements are not supported yet).<BR>
28  */

29 public interface XMLStatement {
30
31     /*********************************************************************/
32     /*************************** Queries execution functions *************/
33     /*********************************************************************/
34
35     /**
36      * Executes a query statement of the type specified when this
37      * object was built with the createStatement method (see XMLConnection interface)
38      * that may return results.
39      * If the query generates results, use the <I>getResultSet()</I> or
40      * <I>getDocumentSet()</I> methods to get the set of results.
41      * @param query the query string.
42      * @return true if there are available resuts, else false.
43      * @deprecated Not useful since updates are not available.
44      * @throws XMLDBCException if a data source access error occurs.
45      */

46     public boolean execute(String JavaDoc query) throws XMLDBCException;
47
48     /**
49      * Executes a query statement of the specified type
50      * that may return results.
51      * If the query generates results, use the <I>getResultSet()</I> or
52      * <I>getDocumentSet()</I> methods to get the set of results.
53      * @param query the query string.
54      * @param queryType the type of query for this statement (see constants in XMLConnection interface).
55      * @return true if there are available resuts, else false.
56      * @deprecated Not useful since updates are not available.
57      * @throws XMLDBCException if a data source access error occurs.
58      */

59     public boolean execute(String JavaDoc query, int queryType) throws XMLDBCException;
60
61     /**
62      * Executes a query statement of the type specified when this
63      * object was built with the createStatement method (see XMLConnection interface)
64      * that returns results.
65      * @param query the query string
66      * @return an XMLResultSet object that contains the data produced by the given query.
67      * @throws XMLDBCException if a data source access error occurs.
68      */

69     public XMLResultSet executeQuery(String JavaDoc query) throws XMLDBCException;
70
71     /**
72      * Executes a query statement of the specified type
73      * that returns results.
74      * If the query generates results, use the <I>getResultSet()</I> or
75      * <I>getDocumentSet()</I> methods to get the set of results.
76      * @param query the query string.
77      * @param queryType the type of query for this statement (see constants in XMLConnection interface).
78      * @return true if there are available resuts, else false.
79      * @throws XMLDBCException if a data source access error occurs.
80      * @deprecated Distinction is no relevant anymore because XPath is now a
81      * subset of XQuery.
82      */

83     public XMLResultSet executeQuery(String JavaDoc query, int queryType) throws XMLDBCException;
84
85     /**
86      * Executes a query statement of the type specified when this
87      * object was built with the createStatement method (see XMLConnection interface)
88      * that returns complete XML documents. It is a error to call this method with a
89      * query that returns document fragments.
90      * @param query a static and read-only query in the specified type.
91      * @return an XMLResultSet object that contains the data produced by the given query.
92      * @throws XMLDBCException if a data source access error occurs, or if the returned
93      * results are not complete XML documents.
94      */

95     public XMLDocumentSet executeDocumentQuery(String JavaDoc query) throws XMLDBCException;
96
97     /*********************************************************************/
98     /*************************** Results management **********************/
99     /*********************************************************************/
100
101     /**
102      * Returns the current statement results as an XMLResultSet object.
103      * @return the current results as an XMLResultSet object or null if there is no result.
104      * @throws XMLDBCException if a data source access error occurs.
105      */

106     public XMLResultSet getResultSet() throws XMLDBCException;
107
108     /**
109      * Returns the current statement results as an XMLDocumentSet object.
110      * It is a error to call this method for a statement that returned
111      * document fragments.
112      * @return the current results as an XMLDocumentSet object or null if there is no result.
113      * @throws XMLDBCException if a data source access error occurs, or if the returned
114      * results are not complete XML documents.
115      */

116     public XMLDocumentSet getDocumentSet() throws XMLDBCException;
117
118     /*********************************************************************/
119     /*************************** Statement management ********************/
120     /*********************************************************************/
121
122     /**
123      * Returns the connection object that produced this statement.
124      * @return the connection object that produced this statement.
125      */

126     public XMLConnection getConnection();
127
128     /**
129      * Releases the statement XMLDBC resources immediately instead of waiting for this
130      * to happen when it is automatically closed.
131      * @throws XMLDBCException if a data source access error occurs.
132      */

133     public void close() throws XMLDBCException;
134     
135     /*********************************************************************/
136     /*************************** extension methods ***********************/
137     /*********************************************************************/
138
139     /**
140      * Sets the base URI for documents.
141      * @return nothing
142      */

143     public void setBaseURI(String JavaDoc baseURI);
144     /**
145      * gets the base URI for documents.
146      * @return the base URI
147      */

148     public String JavaDoc getBaseURI();
149     
150     
151 }
152
153
Popular Tags