KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > execute > RowChanger


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.execute.RowChanger
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.execute;
23
24 import org.apache.derby.iapi.services.context.ContextService;
25 import org.apache.derby.iapi.services.sanity.SanityManager;
26
27 import org.apache.derby.iapi.error.StandardException;
28
29 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
30 import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;
31
32 import org.apache.derby.iapi.store.access.ConglomerateController;
33 import org.apache.derby.iapi.types.RowLocation;
34 import org.apache.derby.iapi.store.access.TransactionController;
35
36 /**
37   Perform row at a time DML operations of tables and maintain indexes.
38   */

39 public interface RowChanger
40 {
41     /**
42       Open this RowChanger.
43
44       <P>Note to avoid the cost of fixing indexes that do not
45       change during update operations use openForUpdate().
46       @param lockMode The lock mode to use
47                             (row or table, see TransactionController)
48
49       @exception StandardException thrown on failure to convert
50       */

51     public void open(int lockMode)
52          throws StandardException;
53
54     /**
55      * Set the row holder for this changer to use.
56      * If the row holder is set, it wont bother
57      * saving copies of rows needed for deferred
58      * processing. Also, it will never close the
59      * passed in rowHolder.
60      *
61      * @param rowHolder the row holder
62      */

63     public void setRowHolder(TemporaryRowHolder rowHolder);
64
65     /**
66      * Sets the index names of the tables indices. Used for error reporting.
67      *
68      * @param indexNames Names of all the indices on this table.
69      */

70     public void setIndexNames(String JavaDoc[] indexNames);
71
72     /**
73       Open this RowChanger to avoid fixing indexes that do not change
74       during update operations.
75
76       @param fixOnUpdate fixOnUpdat[ix] == true ==> fix index 'ix' on
77       an update operation.
78       @param lockMode The lock mode to use
79                             (row or table, see TransactionController)
80       @param wait If true, then the caller wants to wait for locks. False will be
81                             when we using a nested user xaction - we want to timeout right away
82                             if the parent holds the lock. (bug 4821)
83
84       @exception StandardException thrown on failure to convert
85       */

86     public void openForUpdate( boolean[] fixOnUpdate, int lockMode, boolean wait )
87          throws StandardException;
88
89     /**
90       Insert a row into the table and perform associated index maintenance.
91
92       @param baseRow the row.
93       @exception StandardException Thrown on error
94       */

95     public void insertRow(ExecRow baseRow)
96          throws StandardException;
97         
98     /**
99       Delete a row from the table and perform associated index maintenance.
100
101       @param baseRow the row.
102       @param baseRowLocation the row's base conglomerate
103          location
104       @exception StandardException Thrown on error
105       */

106     public void deleteRow(ExecRow baseRow, RowLocation baseRowLocation)
107          throws StandardException;
108
109     /**
110       Update a row in the table and perform associated index maintenance.
111
112       @param oldBaseRow the old image of the row.
113       @param newBaseRow the new image of the row.
114       @param baseRowLocation the row's base conglomerate
115          location
116       @exception StandardException Thrown on error
117       */

118     public void updateRow(ExecRow oldBaseRow,
119                           ExecRow newBaseRow,
120                           RowLocation baseRowLocation)
121          throws StandardException;
122
123     /**
124       Finish processing the changes. This means applying the deferred
125       inserts for updates to unique indexes.
126
127       @exception StandardException Thrown on error
128      */

129     public void finish()
130         throws StandardException;
131
132     /**
133       Close this RowChanger.
134
135       @exception StandardException Thrown on error
136       */

137     public void close()
138         throws StandardException;
139
140     /**
141      * Return the ConglomerateController from this RowChanger.
142      * This is useful when copying properties from heap to
143      * temp conglomerate on insert/update/delete.
144      *
145      * @return The ConglomerateController from this RowChanger.
146      */

147     public ConglomerateController getHeapConglomerateController();
148
149     /**
150       Open this RowChanger.
151
152       <P>Note to avoid the cost of fixing indexes that do not
153       change during update operations use openForUpdate().
154       @param lockMode The lock mode to use
155                             (row or table, see TransactionController)
156       @param wait If true, then the caller wants to wait for locks. False will be
157                             when we using a nested user xaction - we want to timeout right away
158                             if the parent holds the lock.
159
160       @exception StandardException thrown on failure to convert
161       */

162     public void open(int lockMode, boolean wait)
163          throws StandardException;
164 }
165
Popular Tags