private Charset _charset;
/** timezone to use when handling dates */
private TimeZone _timeZone;
+ /** language sort order to be used for textual columns */
+ private Short _defaultSortOrder;
/** the ordering used for table columns */
private Table.ColumnOrder _columnOrder;
/** cache of in-use tables */
return _fileFormat;
}
+ /**
+ * @return the currently configured database default language sort order for
+ * textual columns
+ */
+ public short getDefaultSortOrder() throws IOException {
+
+ if(_defaultSortOrder == null) {
+ _pageChannel.readPage(_buffer, 0);
+ _defaultSortOrder = _buffer.getShort(_format.OFFSET_SORT_ORDER);
+ }
+ return _defaultSortOrder;
+ }
+
/**
* @return a PropertyMaps instance decoded from the given bytes (always
* returns non-{@code null} result).
public final int OFFSET_HEADER_DATE;
public final int OFFSET_PASSWORD;
public final int SIZE_PASSWORD;
+ public final int OFFSET_SORT_ORDER;
public final int OFFSET_ENCODING_KEY;
public final int OFFSET_NEXT_TABLE_DEF_PAGE;
public final int OFFSET_NUM_ROWS;
OFFSET_HEADER_DATE = defineOffsetHeaderDate();
OFFSET_PASSWORD = defineOffsetPassword();
SIZE_PASSWORD = defineSizePassword();
+ OFFSET_SORT_ORDER = defineOffsetSortOrder();
OFFSET_ENCODING_KEY = defineOffsetEncodingKey();
OFFSET_NEXT_TABLE_DEF_PAGE = defineOffsetNextTableDefPage();
OFFSET_NUM_ROWS = defineOffsetNumRows();
protected abstract int defineOffsetHeaderDate();
protected abstract int defineOffsetPassword();
protected abstract int defineSizePassword();
+ protected abstract int defineOffsetSortOrder();
protected abstract int defineOffsetEncodingKey();
protected abstract int defineOffsetNextTableDefPage();
protected abstract int defineOffsetNumRows();
@Override
protected int defineSizePassword() { return 20; }
@Override
+ protected int defineOffsetSortOrder() { return 58; }
+ @Override
protected int defineOffsetEncodingKey() { return 62; }
@Override
protected int defineOffsetNextTableDefPage() { return 4; }
@Override
protected int defineSizePassword() { return 40; }
@Override
+ protected int defineOffsetSortOrder() { return 110; }
+ @Override
protected int defineOffsetEncodingKey() { return 62; }
@Override
protected int defineOffsetNextTableDefPage() { return 4; }
db.close();
}
}
+
+ public void testDbSortOrder() throws Exception {
+
+ for (final TestDB testDB : SUPPORTED_DBS_TEST_FOR_READ) {
+
+ Database db = open(testDB);
+ assertEquals(Column.GENERAL_SORT_ORDER, db.getDefaultSortOrder());
+ db.close();
+ }
+ }
static Object[] createTestRow(String col1Val) {
return new Object[] {col1Val, "R", "McCune", 1234, (byte) 0xad, 555.66d,