aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2012-11-08 04:25:21 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2012-11-08 04:25:21 +0000
commitc0d41579f0184cfc049cb69f1e4f6f46c1fac58a (patch)
tree90c84598415b0756d45a9d9a295ab93388d8f3b6
parentec386dda87d8c710a144108af074e90982cc2257 (diff)
downloadjackcess-c0d41579f0184cfc049cb69f1e4f6f46c1fac58a.tar.gz
jackcess-c0d41579f0184cfc049cb69f1e4f6f46c1fac58a.zip
add support for hyperlink columns
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@653 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml5
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java51
2 files changed, 52 insertions, 4 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6573d46..6e241d2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -4,6 +4,11 @@
<author email="javajedi@users.sf.net">Tim McCune</author>
</properties>
<body>
+ <release version="1.2.10" date="TBD">
+ <action dev="jahlborn" type="update">
+ Add info to the Column to support MEMO columns which are HYPERLINKS.
+ </action>
+ </release>
<release version="1.2.9" date="2012-10-15">
<action dev="jahlborn" type="update">
Add some more functionality to Joiner to facilitate integrity
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index e5503bd..8e3033d 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -139,6 +139,12 @@ public class Column implements Comparable<Column> {
public static final byte AUTO_NUMBER_GUID_FLAG_MASK = (byte)0x40;
/**
+ * mask for the hyperlink bit (on memo types)
+ * @usage _advanced_field_
+ */
+ public static final byte HYPERLINK_FLAG_MASK = (byte)0x80;
+
+ /**
* mask for the unknown bit (possible "can be null"?)
* @usage _advanced_field_
*/
@@ -288,6 +294,11 @@ public class Column implements Comparable<Column> {
_textInfo._compressedUnicode = ((buffer.get(offset +
getFormat().OFFSET_COLUMN_COMPRESSED_UNICODE) & 1) == 1);
+
+ if(_type == DataType.MEMO) {
+ // only memo fields can be hyperlinks
+ _textInfo._hyperlink = ((flags & HYPERLINK_FLAG_MASK) != 0);
+ }
}
setAutoNumberGenerator();
@@ -623,6 +634,23 @@ public class Column implements Comparable<Column> {
modifyTextInfo();
_textInfo._versionHistoryCol = versionHistoryCol;
}
+
+ /**
+ * Returns whether or not this is a hyperlink column (only possible for
+ * columns of type MEMO).
+ * @usage _general_method_
+ */
+ public boolean isHyperlink() {
+ return _textInfo._hyperlink;
+ }
+
+ /**
+ * @usage _general_method_
+ */
+ public void setHyperlink(boolean hyperlink) {
+ modifyTextInfo();
+ _textInfo._hyperlink = hyperlink;
+ }
/**
* Returns extended functionality for "complex" columns.
@@ -771,6 +799,13 @@ public class Column implements Comparable<Column> {
"Only textual columns allow unicode compression (text/memo)");
}
}
+
+ if(isHyperlink()) {
+ if(getType() != DataType.MEMO) {
+ throw new IllegalArgumentException(
+ "Only memo columns can be hyperlinks");
+ }
+ }
}
public Object setRowValue(Object[] rowArray, Object value) {
@@ -1733,13 +1768,16 @@ public class Column implements Comparable<Column> {
* Constructs a byte containing the flags for this column.
*/
private byte getColumnBitFlags() {
- byte flags = Column.UNKNOWN_FLAG_MASK;
+ byte flags = UNKNOWN_FLAG_MASK;
if(!isVariableLength()) {
- flags |= Column.FIXED_LEN_FLAG_MASK;
+ flags |= FIXED_LEN_FLAG_MASK;
}
if(isAutoNumber()) {
flags |= getAutoNumberGenerator().getColumnFlags();
}
+ if(isHyperlink()) {
+ flags |= HYPERLINK_FLAG_MASK;
+ }
return flags;
}
@@ -1765,6 +1803,9 @@ public class Column implements Comparable<Column> {
if(isAppendOnly()) {
rtn.append("\n\tAppend only: " + isAppendOnly());
}
+ if(isHyperlink()) {
+ rtn.append("\n\tHyperlink: " + isHyperlink());
+ }
}
if(_autoNumber) {
rtn.append("\n\tLast AutoNumber: " + _autoNumberGenerator.getLast());
@@ -2018,8 +2059,7 @@ public class Column implements Comparable<Column> {
// we specifically put the "long variable" values after the normal
// variable length values so that we have a better chance of fitting it
// all (because "long variable" values can go in separate pages)
- short longVariableOffset =
- Column.countNonLongVariableLength(columns);
+ short longVariableOffset = countNonLongVariableLength(columns);
for (Column col : columns) {
// record this for later use when writing indexes
col.setColumnNumber(columnNumber);
@@ -2398,5 +2438,8 @@ public class Column implements Comparable<Column> {
/** complex column which tracks the version history for this "append only"
column */
private Column _versionHistoryCol;
+ /** whether or not this is a hyperlink column (only possible for columns
+ of type MEMO) */
+ private boolean _hyperlink;
}
}