new LinkedHashMap<String,Object>();
for(Index.ColumnDescriptor idxCol : index.getColumns()) {
indexRowPattern.put(idxCol.getName(),
- rowValues[idxCol.getColumnNumber()]);
+ rowValues[idxCol.getColumnIndex()]);
}
}
", expected " + _columns.size());
}
int valIdx = 0;
- Object[] idxRow = new Object[getTable().getMaxColumnCount()];
+ Object[] idxRow = new Object[getTable().getColumnCount()];
for(ColumnDescriptor col : _columns) {
- idxRow[col.getColumnNumber()] = values[valIdx++];
+ idxRow[col.getColumnIndex()] = values[valIdx++];
}
return idxRow;
}
}
}
- Object[] idxRow = new Object[getTable().getMaxColumnCount()];
+ Object[] idxRow = new Object[getTable().getColumnCount()];
for(ColumnDescriptor col : _columns) {
- idxRow[col.getColumnNumber()] = row.get(col.getName());
+ idxRow[col.getColumnIndex()] = row.get(col.getName());
}
return idxRow;
}
// annoyingly, the values array could come from different sources, one
// of which will make it a different size than the other. we need to
// handle both situations.
- boolean useColNumber = (values.length >= _table.getMaxColumnCount());
int nullCount = 0;
for(ColumnDescriptor col : _columns) {
- Object value = values[
- useColNumber ? col.getColumnNumber() : col.getColumnIndex()];
+ Object value = values[col.getColumnIndex()];
if(col.isNullValue(value)) {
++nullCount;
}
// annoyingly, the values array could come from different sources, one
// of which will make it a different size than the other. we need to
// handle both situations.
- boolean useColNumber = (values.length >= _table.getMaxColumnCount());
for(ColumnDescriptor col : _columns) {
- Object value = values[
- useColNumber ? col.getColumnNumber() : col.getColumnIndex()];
+ Object value = values[col.getColumnIndex()];
col.writeValue(value, bout);
}
return((getFlags() & ASCENDING_COLUMN_FLAG) != 0);
}
- public int getColumnNumber() {
- return getColumn().getColumnNumber();
- }
-
public int getColumnIndex() {
return getColumn().getColumnIndex();
}
public ByteBuffer wrap() {
return ByteBuffer.wrap(_mask);
}
-
+
/**
- * @param columnNumber 0-based column number in this mask's row
+ * @param column column to test for {@code null}
* @return Whether or not the value for that column is null. For boolean
* columns, returns the actual value of the column (where
* non-{@code null} == {@code true})
*/
- public boolean isNull(int columnNumber) {
+ public boolean isNull(Column column) {
+ int columnNumber = column.getColumnNumber();
int maskIndex = columnNumber / 8;
// if new columns were added to the table, old null masks may not include
// them (meaning the field is null)
/**
* Indicate that the column with the given number is not {@code null} (or a
* boolean value is {@code true}).
- * @param columnNumber 0-based column number in this mask's row
+ * @param column column to be marked non-{@code null}
*/
- public void markNotNull(int columnNumber) {
+ public void markNotNull(Column column) {
+ int columnNumber = column.getColumnNumber();
int maskIndex = columnNumber / 8;
_mask[maskIndex] = (byte) (_mask[maskIndex] | (byte) (1 << (columnNumber % 8)));
}
// deletion. note, most of the returned values are immutable, except
// for binary data (returned as byte[]), but binary data shouldn't be
// indexed anyway.
- rowState.setRowValue(column.getColumnNumber(), value);
+ rowState.setRowValue(column.getColumnIndex(), value);
return value;
}
// deletion. note, most of the returned values are immutable, except
// for binary data (returned as byte[]), but binary data shouldn't be
// indexed anyway.
- rowState.setRowValue(column.getColumnNumber(), value);
+ rowState.setRowValue(column.getColumnIndex(), value);
}
}
return rtn;
Column column)
throws IOException
{
- boolean isNull = nullMask.isNull(column.getColumnNumber());
+ boolean isNull = nullMask.isNull(column);
if(column.getType() == DataType.BOOLEAN) {
return Boolean.valueOf(!isNull); //Boolean values are stored in the null mask
} else if(isNull) {
if(Column.toBooleanValue(rowValue)) {
//Booleans are stored in the null mask
- nullMask.markNotNull(col.getColumnNumber());
+ nullMask.markNotNull(col);
}
} else {
if(rowValue != null) {
// we have a value
- nullMask.markNotNull(col.getColumnNumber());
+ nullMask.markNotNull(col);
//remainingRowLength is ignored when writing fixed length data
buffer.position(fixedDataStart + col.getFixedDataOffset());
Object rowValue = row.get(varCol.getColumnIndex());
if (rowValue != null) {
// we have a value
- nullMask.markNotNull(varCol.getColumnNumber());
+ nullMask.markNotNull(varCol);
ByteBuffer varDataBuf = varCol.write(rowValue, maxRowSize);
maxRowSize -= varDataBuf.remaining();
private RowState(boolean hardRowBuffer) {
_headerRowBufferH = TempPageHolder.newHolder(hardRowBuffer);
- _rowValues = new Object[Table.this.getMaxColumnCount()];
+ _rowValues = new Object[Table.this.getColumnCount()];
_lastModCount = Table.this._modCount;
}