KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > databaseaccess > QueryStringCall


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.databaseaccess;
23
24 import java.util.*;
25 import java.io.*;
26 import oracle.toplink.essentials.queryframework.*;
27 import oracle.toplink.essentials.internal.helper.*;
28 import oracle.toplink.essentials.internal.sessions.AbstractRecord;
29 import oracle.toplink.essentials.internal.sessions.AbstractSession;
30
31 /**
32  * INTERNAL:
33  * <b>Purpose<b>: Used to define query string calls.
34  * These include SQLCall, XQueryInteraction which reuse translation behavoir through
35  * this interface.
36  *
37  * @author James Sutherland
38  * @since OracleAS TopLink 10<i>g</i> (10.0.3)
39  */

40 public interface QueryStringCall extends Call {
41
42     /**
43      * The parameters are the values in order of occurance in the SQL statement.
44      * This is lazy initialized to conserv space on calls that have no parameters.
45      */

46     public Vector getParameters();
47
48     /**
49      * The parameter types determine if the parameter is a modify, translation or litteral type.
50      */

51     public Vector getParameterTypes();
52
53     /**
54      * The parameters are the values in order of occurance in call.
55      * This is lazy initialized to conserv space on calls that have no parameters.
56      */

57     public boolean hasParameters();
58
59     /**
60      * Allow pre-printing of the query/SQL string for fully bound calls, to save from reprinting.
61      * This should call translateCustomQuery() in the call implementation.
62      */

63     public void prepare(AbstractSession session);
64
65     /**
66      * Allow the call to translate from the translation for predefined calls.
67      * This should call translateQueryString() in the call implementation.
68      */

69     public void translate(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session);
70
71     /**
72      * Return the query string of the call.
73      * This must be overwritten by subclasses that support query language translation (SQLCall, XQueryCall).
74      */

75     public String JavaDoc getQueryString();
76
77     /**
78      * Set the query string of the call.
79      * This must be overwritten by subclasses that support query language translation (SQLCall, XQueryCall).
80      */

81     public void setQueryString(String JavaDoc queryString);
82
83     /**
84      * Parse the query string for # markers for custom query based on a query language.
85      * This is used by SQLCall and XQuery call, but can be reused by other query languages.
86      */

87     public void translateCustomQuery();
88
89     /**
90      * All values are printed as ? to allow for parameter binding or translation during the execute of the call.
91      */

92     public void appendLiteral(Writer writer, Object JavaDoc literal);
93
94     /**
95      * All values are printed as ? to allow for parameter binding or translation during the execute of the call.
96      */

97     public void appendTranslation(Writer writer, DatabaseField modifyField);
98
99     /**
100      * All values are printed as ? to allow for parameter binding or translation during the execute of the call.
101      */

102     public void appendModify(Writer writer, DatabaseField modifyField);
103
104     /**
105      * Add the parameter.
106      * If using binding bind the parameter otherwise let the platform print it.
107      * The platform may also decide to bind the value.
108      */

109     public void appendParameter(Writer writer, Object JavaDoc parameter, AbstractSession session);
110
111     /**
112      * Allow the call to translate from the translation for predefined calls.
113      */

114     public void translateQueryString(AbstractRecord translationRow, AbstractRecord modifyRow, AbstractSession session);
115
116     /**
117      * Should return true.
118      */

119     public boolean isQueryStringCall();
120 }
121
Popular Tags