Fix problem with creating tables with indexes where ms access could
not open the created table.
</action>
+ <action dev="jahlborn" type="fix" issue="3435774">
+ Fix problem with reading row from table with deleted/added columns.
+ </action>
</release>
<release version="1.2.5" date="2011-10-19">
<action dev="jahlborn" type="update">
*/
public class NullMask {
+ /** num row columns */
+ private final int _columnCount;
/** The actual bitmask */
- private byte[] _mask;
+ private final byte[] _mask;
/**
* @param columnCount Number of columns in the row that this mask will be
* used for
*/
public NullMask(int columnCount) {
+ _columnCount = columnCount;
// we leave everything initially marked as null so that we don't need to
// do anything for deleted columns (we only need to mark as non-null
// valid columns for which we actually have values).
- _mask = new byte[(columnCount + 7) / 8];
+ _mask = new byte[(_columnCount + 7) / 8];
}
/**
*/
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)
- if(maskIndex >= _mask.length) {
+ if(columnNumber >= _columnCount) {
// it's null
return true;
}
- return (_mask[maskIndex] & (byte) (1 << (columnNumber % 8))) == 0;
+ return (_mask[byteIndex(columnNumber)] & bitMask(columnNumber)) == 0;
}
/**
*/
public void markNotNull(Column column) {
int columnNumber = column.getColumnNumber();
- int maskIndex = columnNumber / 8;
- _mask[maskIndex] = (byte) (_mask[maskIndex] | (byte) (1 << (columnNumber % 8)));
+ int maskIndex = byteIndex(columnNumber);
+ _mask[maskIndex] = (byte) (_mask[maskIndex] | bitMask(columnNumber));
}
/**
public int byteSize() {
return _mask.length;
}
-
+
+ private static int byteIndex(int columnNumber) {
+ return columnNumber / 8;
+ }
+
+ private static byte bitMask(int columnNumber) {
+ return (byte) (1 << (columnNumber % 8));
+ }
}