1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.iapi.sql.execute.ExecIndexRow; 27 import org.apache.derby.iapi.sql.execute.ExecRow; 28 29 import org.apache.derby.iapi.services.io.Formatable; 30 import org.apache.derby.iapi.services.io.StoredFormatIds; 31 import org.apache.derby.iapi.services.io.FormatIdUtil; 32 33 import org.apache.derby.iapi.services.stream.HeaderPrintWriter; 34 35 import java.io.ObjectOutput ; 36 import java.io.ObjectInput ; 37 import java.io.IOException ; 38 39 40 45 public class IndexRow extends ValueRow implements ExecIndexRow 46 { 47 60 61 67 68 private boolean[] orderedNulls; 69 70 76 80 public IndexRow() {} 81 82 public IndexRow(int ncols) { 83 super(ncols); 84 orderedNulls = new boolean[ncols]; 85 } 86 87 93 94 public void orderedNulls(int columnPosition) { 95 orderedNulls[columnPosition] = true; 96 } 97 98 public boolean areNullsOrdered(int columnPosition) { 99 return orderedNulls[columnPosition]; 100 } 101 102 105 public void execRowToExecIndexRow(ExecRow valueRow) 106 { 107 if (SanityManager.DEBUG) 108 { 109 SanityManager.THROWASSERT( 110 "execRowToExecIndexRow() not expected to be called for IndexRow"); 111 } 112 } 113 114 120 128 public void readExternal( ObjectInput in ) 129 throws IOException , ClassNotFoundException 130 { 131 super.readExternal( in ); 132 133 int colCount = nColumns(); 134 135 orderedNulls = new boolean[ colCount ]; 136 for ( int ictr = 0; ictr < colCount; ictr++ ) { orderedNulls[ ictr ] = in.readBoolean(); } 137 } 138 139 146 public void writeExternal( ObjectOutput out ) 147 throws IOException 148 { 149 super.writeExternal( out ); 150 int colCount = nColumns(); 151 152 for ( int ictr = 0; ictr < colCount; ictr++ ) { out.writeBoolean( orderedNulls[ ictr ] ); } 153 } 154 155 160 public int getTypeFormatId() { return StoredFormatIds.INDEX_ROW_V01_ID; } 161 162 ExecRow cloneMe() { 163 return new IndexRow(nColumns()); 164 } 165 } 166 | Popular Tags |