KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > accesslayer > StatementManagerIF


1 package org.apache.ojb.broker.accesslayer;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import java.sql.PreparedStatement JavaDoc;
19 import java.sql.ResultSet JavaDoc;
20 import java.sql.SQLException JavaDoc;
21 import java.sql.Statement JavaDoc;
22
23 import org.apache.ojb.broker.Identity;
24 import org.apache.ojb.broker.PersistenceBrokerException;
25 import org.apache.ojb.broker.PersistenceBrokerSQLException;
26 import org.apache.ojb.broker.core.ValueContainer;
27 import org.apache.ojb.broker.metadata.ClassDescriptor;
28 import org.apache.ojb.broker.query.Query;
29
30 /**
31  * @version $Id: StatementManagerIF.java,v 1.10.2.3 2005/12/21 22:22:58 tomdz Exp $
32  */

33 public interface StatementManagerIF
34 {
35
36     /** fetchSize hint marking that setting fetch size for current statement is N/A. */
37     int FETCH_SIZE_NOT_APPLICABLE = -1;
38     /** fetchSize hint marking that there is no statement-level explicit override. */
39     int FETCH_SIZE_NOT_EXPLICITLY_SET = 0;
40
41     /**
42      * Binds the Identities Primary key values to the statement.
43      * @param stmt
44      * @param oid
45      * @param cld ClassDescriptor for the Object, if <i>null</i> will be lookup automatic
46      */

47     void bindDelete(PreparedStatement JavaDoc stmt, Identity oid, ClassDescriptor cld) throws java.sql.SQLException JavaDoc;
48     /**
49      * binds the objects primary key and locking values to the statement, BRJ
50      */

51     void bindDelete(PreparedStatement JavaDoc stmt, ClassDescriptor cld, Object JavaDoc obj)
52         throws java.sql.SQLException JavaDoc;
53
54     /**
55      * bind a Query based Select Statement
56      */

57     int bindStatement(PreparedStatement JavaDoc stmt, Query query, ClassDescriptor cld, int param)
58         throws SQLException JavaDoc;
59
60     /**
61      * binds the values of the object obj to the statements parameters
62      */

63     void bindInsert(PreparedStatement JavaDoc stmt, ClassDescriptor cld, Object JavaDoc obj)
64         throws SQLException JavaDoc;
65     /**
66      * binds the Identities Primary key values to the statement
67      * @param stmt
68      * @param oid
69      * @param cld ClassDescriptor for the Object, if <i>null</i> will be lookup automatic
70      * @param callableStmt Indicate if the specified {@link java.sql.PreparedStatement}
71      * is a {@link java.sql.CallableStatement} supporting stored procedures.
72      */

73     void bindSelect(PreparedStatement JavaDoc stmt, Identity oid, ClassDescriptor cld, boolean callableStmt) throws SQLException JavaDoc;
74     /**
75      * binds the values of the object obj to the statements parameters
76      */

77     void bindUpdate(PreparedStatement JavaDoc stmt, ClassDescriptor cld, Object JavaDoc obj)
78         throws SQLException JavaDoc;
79
80     /**
81      * binds the given array of values (if not null) starting from the given
82      * parameter index
83      * @return the next parameter index
84      */

85     int bindValues(PreparedStatement JavaDoc stmt, ValueContainer[] valueContainer, int index) throws SQLException JavaDoc;
86
87     /**
88      * return a prepared DELETE Statement fitting for the given ClassDescriptor
89      */

90     PreparedStatement JavaDoc getDeleteStatement(ClassDescriptor cds)
91         throws PersistenceBrokerSQLException;
92     /**
93      * return a generic Statement for the given ClassDescriptor
94      */

95     Statement JavaDoc getGenericStatement(ClassDescriptor cds, boolean scrollable) throws PersistenceBrokerException;
96     /**
97      * return a prepared Insert Statement fitting for the given ClassDescriptor
98      */

99     PreparedStatement JavaDoc getInsertStatement(ClassDescriptor cds)
100         throws PersistenceBrokerSQLException;
101     /**
102      * Return a PreparedStatement for selecting against the given ClassDescriptor.
103      */

104     PreparedStatement JavaDoc getPreparedStatement(ClassDescriptor cds, String JavaDoc sql,
105                                            boolean scrollable, int explicitFetchSizeHint, boolean callableStmt)
106         throws PersistenceBrokerException;
107     /**
108      * return a prepared Select Statement for the given ClassDescriptor
109      */

110     PreparedStatement JavaDoc getSelectByPKStatement(ClassDescriptor cds)
111         throws PersistenceBrokerSQLException;
112     /**
113      * return a prepared Update Statement fitting to the given ClassDescriptor
114      */

115     PreparedStatement JavaDoc getUpdateStatement(ClassDescriptor cds)
116         throws PersistenceBrokerSQLException;
117
118     public void closeResources(Statement JavaDoc stmt, ResultSet JavaDoc rs);
119
120 }
121
Popular Tags