001: /*
002:
003: Derby - Class org.apache.derby.impl.sql.execute.IndexValueRow
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.sql.execute;
023:
024: import org.apache.derby.iapi.services.sanity.SanityManager;
025: import org.apache.derby.iapi.services.io.Storable;
026: import org.apache.derby.iapi.error.StandardException;
027:
028: import org.apache.derby.iapi.sql.execute.ExecutionContext;
029: import org.apache.derby.iapi.sql.execute.ExecIndexRow;
030: import org.apache.derby.iapi.sql.execute.ExecRow;
031:
032: import org.apache.derby.iapi.types.DataValueDescriptor;
033:
034: import java.sql.ResultSet;
035:
036: import org.apache.derby.iapi.services.io.FormatableBitSet;
037:
038: /**
039: Mapper of ValueRow into ExecIndexRow.
040:
041: @author ames
042: */
043: class IndexValueRow implements ExecIndexRow {
044:
045: private ExecRow valueRow;
046:
047: IndexValueRow(ExecRow valueRow) {
048: this .valueRow = valueRow;
049: }
050:
051: /*
052: * class interface
053: */
054: public String toString() {
055: return valueRow.toString();
056: }
057:
058: /**
059: Get the array form of the row that Access expects.
060:
061: @see ExecRow#getRowArray
062: */
063: public DataValueDescriptor[] getRowArray() {
064: return valueRow.getRowArray();
065: }
066:
067: /** @see ExecRow#getRowArray */
068: public void setRowArray(DataValueDescriptor[] value) {
069: valueRow.setRowArray(value);
070: }
071:
072: public void setRowArray(Storable[] value) {
073: valueRow.setRowArray(value);
074: }
075:
076: /**
077: Get a clone of the array form of the row that Access expects.
078:
079: @see ExecRow#getRowArray
080: */
081: public DataValueDescriptor[] getRowArrayClone() {
082: return valueRow.getRowArrayClone();
083: }
084:
085: // this is the actual current # of columns
086: public int nColumns() {
087: return valueRow.nColumns();
088: }
089:
090: /*
091: * Row interface
092: */
093: // position is 1-based
094: public DataValueDescriptor getColumn(int position)
095: throws StandardException {
096: return valueRow.getColumn(position);
097: }
098:
099: // position is 1-based.
100: public void setColumn(int position, DataValueDescriptor col) {
101: valueRow.setColumn(position, col);
102: }
103:
104: // position is 1-based
105: public ExecRow getClone() {
106: return new IndexValueRow(valueRow.getClone());
107: }
108:
109: public ExecRow getClone(FormatableBitSet clonedCols) {
110: return new IndexValueRow(valueRow.getClone(clonedCols));
111: }
112:
113: public ExecRow getNewNullRow() {
114: return new IndexValueRow(valueRow.getNewNullRow());
115: }
116:
117: // position is 1-based
118: public DataValueDescriptor cloneColumn(int columnPosition) {
119: return valueRow.cloneColumn(columnPosition);
120: }
121:
122: /*
123: * ExecIndexRow interface
124: */
125:
126: public void orderedNulls(int columnPosition) {
127: if (SanityManager.DEBUG) {
128: SanityManager.THROWASSERT("Not expected to be called");
129: }
130: }
131:
132: public boolean areNullsOrdered(int columnPosition) {
133: if (SanityManager.DEBUG) {
134: SanityManager.THROWASSERT("Not expected to be called");
135: }
136:
137: return false;
138: }
139:
140: /**
141: * Turn the ExecRow into an ExecIndexRow.
142: */
143: public void execRowToExecIndexRow(ExecRow valueRow) {
144: this .valueRow = valueRow;
145: }
146:
147: public void getNewObjectArray() {
148: valueRow.getNewObjectArray();
149: }
150: }
|