KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > execute > IndexValueRow


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.IndexValueRow
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.impl.sql.execute;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25 import org.apache.derby.iapi.services.io.Storable;
26 import org.apache.derby.iapi.error.StandardException;
27
28 import org.apache.derby.iapi.sql.execute.ExecutionContext;
29 import org.apache.derby.iapi.sql.execute.ExecIndexRow;
30 import org.apache.derby.iapi.sql.execute.ExecRow;
31
32 import org.apache.derby.iapi.types.DataValueDescriptor;
33
34 import java.sql.ResultSet JavaDoc;
35
36 import org.apache.derby.iapi.services.io.FormatableBitSet;
37
38 /**
39     Mapper of ValueRow into ExecIndexRow.
40
41     @author ames
42  */

43 class IndexValueRow implements ExecIndexRow {
44
45     private ExecRow valueRow;
46
47     IndexValueRow(ExecRow valueRow) {
48          this.valueRow = valueRow;
49     }
50
51     /*
52      * class interface
53      */

54     public String JavaDoc toString() {
55         return valueRow.toString();
56     }
57
58
59     /**
60         Get the array form of the row that Access expects.
61
62         @see ExecRow#getRowArray
63     */

64     public DataValueDescriptor[] getRowArray() {
65         return valueRow.getRowArray();
66     }
67
68     /** @see ExecRow#getRowArray */
69     public void setRowArray(DataValueDescriptor[] value)
70     {
71         valueRow.setRowArray(value);
72     }
73     public void setRowArray(Storable[] value)
74     {
75         valueRow.setRowArray(value);
76     }
77
78     /**
79         Get a clone of the array form of the row that Access expects.
80
81         @see ExecRow#getRowArray
82     */

83     public DataValueDescriptor[] getRowArrayClone()
84     {
85         return valueRow.getRowArrayClone();
86     }
87
88     // this is the actual current # of columns
89
public int nColumns() {
90         return valueRow.nColumns();
91     }
92
93     /*
94      * Row interface
95      */

96     // position is 1-based
97
public DataValueDescriptor getColumn (int position) throws StandardException {
98         return valueRow.getColumn(position);
99     }
100
101     // position is 1-based.
102
public void setColumn(int position, DataValueDescriptor col) {
103         valueRow.setColumn(position, col);
104     }
105
106     // position is 1-based
107
public ExecRow getClone() {
108         return new IndexValueRow(valueRow.getClone());
109     }
110
111     public ExecRow getClone(FormatableBitSet clonedCols) {
112         return new IndexValueRow(valueRow.getClone(clonedCols));
113     }
114
115     public ExecRow getNewNullRow() {
116         return new IndexValueRow(valueRow.getNewNullRow());
117     }
118
119     // position is 1-based
120
public DataValueDescriptor cloneColumn(int columnPosition)
121     {
122         return valueRow.cloneColumn(columnPosition);
123     }
124
125     /*
126      * ExecIndexRow interface
127      */

128
129     public void orderedNulls(int columnPosition) {
130         if (SanityManager.DEBUG) {
131             SanityManager.THROWASSERT("Not expected to be called");
132         }
133     }
134
135     public boolean areNullsOrdered(int columnPosition) {
136         if (SanityManager.DEBUG) {
137             SanityManager.THROWASSERT("Not expected to be called");
138         }
139
140         return false;
141     }
142
143     /**
144      * Turn the ExecRow into an ExecIndexRow.
145      */

146     public void execRowToExecIndexRow(ExecRow valueRow)
147     {
148         this.valueRow = valueRow;
149     }
150
151     public void getNewObjectArray()
152     {
153         valueRow.getNewObjectArray();
154     }
155 }
156
Popular Tags