KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > JdbcState


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;
13
14 import com.versant.core.metadata.FetchGroup;
15 import com.versant.core.common.State;
16 import com.versant.core.jdbc.metadata.JdbcField;
17 import com.versant.core.server.PersistGraph;
18
19 import java.sql.ResultSet JavaDoc;
20 import java.sql.SQLException JavaDoc;
21 import java.sql.PreparedStatement JavaDoc;
22
23 /**
24  * State's used by the {@link JdbcStorageManager} must implement this.
25  */

26 public interface JdbcState {
27
28     /**
29      * Populate this State from the given ResultSet. The firstCol parameter
30      * specifies the column index of the first column to read from rs. All
31      * persistent pass 1 fields in the fetch group must be read in order.
32      */

33     public void copyPass1Fields(ResultSet JavaDoc rs, FetchGroup fetchGroup,
34             int firstCol) throws SQLException JavaDoc;
35
36     public void copyPass1Fields(ResultSet JavaDoc rs, JdbcField[] fields);
37
38     /**
39      * Set parameters on a PrepareStatement from this State. The firstParam
40      * parameter specifies the column index of the first parameter to set.
41      * Entries in fieldNos that are less than 0 should be skipped.
42      *
43      * @param firstFieldNo The index of the first field to set
44      * @param lastFieldNo The index of the last field to set + 1
45      * @param tableNo Set fields with table == jdbcClass.allTables[tableNo]
46      * @return the index of the last param set + 1
47      */

48     public int setParams(PreparedStatement JavaDoc ps, int[] fieldNos,
49             int firstFieldNo, int lastFieldNo, int firstParam,
50             PersistGraph pGraph, int tableNo) throws SQLException JavaDoc;
51
52     /**
53      * Set parameters on a PrepareStatement from this State for fields that
54      * are not null and that are included when doing changed optimistic locking.
55      * The firstParam parameter specifies the column index of the first
56      * parameter. This will not be called for classes that are not stored by
57      * the JdbcDataStore or that do not use changed optimistic locking.
58      * Entries in fieldNos that are less than 0 should be skipped.
59      *
60      * @param firstFieldNo The index of the first field to set
61      * @param lastFieldNo The index of the last field to set + 1
62      * @param tableNo
63      * @return the index of the last param set + 1
64      */

65     public int setParamsChangedAndNotNull(PreparedStatement JavaDoc ps, int[] fieldNos,
66             int firstFieldNo, int lastFieldNo, int firstParam,
67             PersistGraph pGraph, int tableNo) throws SQLException JavaDoc;
68
69     /**
70      * Set parameters on a PrepareStatement from the optimistic locking field
71      * for the class for this State. The firstParam parameter specifies the
72      * column index of the first parameter to set.
73      *
74      * @return the index of the last param set + 1
75      * @throws javax.jdo.JDOFatalInternalException
76      * if there is no such field
77      * @see com.versant.core.jdbc.metadata.JdbcClass#optimisticLockingField
78      */

79     public int setOptimisticLockingParams(PreparedStatement JavaDoc ps, int firstParam)
80             throws SQLException JavaDoc;
81
82     /**
83      * Call the set(rs,...) method on each of the converters for the first
84      * numFieldNos entries in stateFieldNos. This is used to handle Oracle
85      * style LOB columns.
86      *
87      * @param firstCol The first column in rs to use
88      * @see com.versant.core.jdbc.JdbcConverter#set
89      */

90     public void setOracleStyleLOBs(ResultSet JavaDoc rs, int[] stateFieldNos,
91             int numFieldNos, int firstCol) throws SQLException JavaDoc;
92
93     /**
94      * Does this State contain exactly the same null fields as the supplied
95      * State? A null field is a field that is filled in mask but that is
96      * null or not filled in this state. This must always return true for
97      * classes that do not use changed optimistic locking or that are not
98      * stored by the JdbcDataStore.
99      *
100      * @param state State to compare to (will be for same class)
101      * @param mask State providing the filled states to check
102      */

103     public boolean hasSameNullFields(State state, State mask);
104
105 }
106
107
Popular Tags