Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
StatementManagerIF |
|
| 1.0;1 |
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; | |
19 | import java.sql.ResultSet; | |
20 | import java.sql.SQLException; | |
21 | import java.sql.Statement; | |
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.1 2007-08-24 22:17:30 ewestfal 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 stmt, Identity oid, ClassDescriptor cld) throws java.sql.SQLException; | |
48 | /** | |
49 | * binds the objects primary key and locking values to the statement, BRJ | |
50 | */ | |
51 | void bindDelete(PreparedStatement stmt, ClassDescriptor cld, Object obj) | |
52 | throws java.sql.SQLException; | |
53 | ||
54 | /** | |
55 | * bind a Query based Select Statement | |
56 | */ | |
57 | int bindStatement(PreparedStatement stmt, Query query, ClassDescriptor cld, int param) | |
58 | throws SQLException; | |
59 | ||
60 | /** | |
61 | * binds the values of the object obj to the statements parameters | |
62 | */ | |
63 | void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) | |
64 | throws SQLException; | |
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 stmt, Identity oid, ClassDescriptor cld, boolean callableStmt) throws SQLException; | |
74 | /** | |
75 | * binds the values of the object obj to the statements parameters | |
76 | */ | |
77 | void bindUpdate(PreparedStatement stmt, ClassDescriptor cld, Object obj) | |
78 | throws SQLException; | |
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 stmt, ValueContainer[] valueContainer, int index) throws SQLException; | |
86 | ||
87 | /** | |
88 | * return a prepared DELETE Statement fitting for the given ClassDescriptor | |
89 | */ | |
90 | PreparedStatement getDeleteStatement(ClassDescriptor cds) | |
91 | throws PersistenceBrokerSQLException; | |
92 | /** | |
93 | * return a generic Statement for the given ClassDescriptor | |
94 | */ | |
95 | Statement getGenericStatement(ClassDescriptor cds, boolean scrollable) throws PersistenceBrokerException; | |
96 | /** | |
97 | * return a prepared Insert Statement fitting for the given ClassDescriptor | |
98 | */ | |
99 | PreparedStatement getInsertStatement(ClassDescriptor cds) | |
100 | throws PersistenceBrokerSQLException; | |
101 | /** | |
102 | * Return a PreparedStatement for selecting against the given ClassDescriptor. | |
103 | */ | |
104 | PreparedStatement getPreparedStatement(ClassDescriptor cds, String 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 getSelectByPKStatement(ClassDescriptor cds) | |
111 | throws PersistenceBrokerSQLException; | |
112 | /** | |
113 | * return a prepared Update Statement fitting to the given ClassDescriptor | |
114 | */ | |
115 | PreparedStatement getUpdateStatement(ClassDescriptor cds) | |
116 | throws PersistenceBrokerSQLException; | |
117 | ||
118 | public void closeResources(Statement stmt, ResultSet rs); | |
119 | ||
120 | } |