aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2011-03-31 03:58:26 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2011-03-31 03:58:26 +0000
commit72f50d3386f4432cec006e7167d0da1d1ae831c8 (patch)
treece75a5536e07efa7e09a6c963ebd077dca260ece /src/java/com
parentfbaa90e40a43ad6951a87917777b2495270a816b (diff)
downloadjackcess-72f50d3386f4432cec006e7167d0da1d1ae831c8.tar.gz
jackcess-72f50d3386f4432cec006e7167d0da1d1ae831c8.zip
add method to grab default sort order
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@541 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java15
-rw-r--r--src/java/com/healthmarketscience/jackcess/JetFormat.java7
2 files changed, 22 insertions, 0 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index 5915d2c..9fd6b3b 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -398,6 +398,8 @@ public class Database
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 */
@@ -888,6 +890,19 @@ public class Database
}
/**
+ * @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).
*/
diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java
index dbe3e47..f319b24 100644
--- a/src/java/com/healthmarketscience/jackcess/JetFormat.java
+++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java
@@ -175,6 +175,7 @@ public abstract class JetFormat {
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;
@@ -300,6 +301,7 @@ public abstract class JetFormat {
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();
@@ -393,6 +395,7 @@ public abstract class JetFormat {
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();
@@ -520,6 +523,8 @@ public abstract class JetFormat {
@Override
protected int defineSizePassword() { return 20; }
@Override
+ protected int defineOffsetSortOrder() { return 58; }
+ @Override
protected int defineOffsetEncodingKey() { return 62; }
@Override
protected int defineOffsetNextTableDefPage() { return 4; }
@@ -715,6 +720,8 @@ public abstract class JetFormat {
@Override
protected int defineSizePassword() { return 40; }
@Override
+ protected int defineOffsetSortOrder() { return 110; }
+ @Override
protected int defineOffsetEncodingKey() { return 62; }
@Override
protected int defineOffsetNextTableDefPage() { return 4; }