You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MemoColumnImpl.java 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. Copyright (c) 2014 James Ahlborn
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.healthmarketscience.jackcess.impl;
  14. import java.io.IOException;
  15. /**
  16. * ColumnImpl subclass which is used for Memo data types.
  17. *
  18. * @author James Ahlborn
  19. * @usage _advanced_class_
  20. */
  21. class MemoColumnImpl extends LongValueColumnImpl
  22. {
  23. /** whether or not they are compressed */
  24. private final boolean _compressedUnicode;
  25. /** the collating sort order for a text field */
  26. private final SortOrder _sortOrder;
  27. /** the code page for a text field (for certain db versions) */
  28. private final short _codePage;
  29. /** complex column which tracks the version history for this "append only"
  30. column */
  31. private ColumnImpl _versionHistoryCol;
  32. /** whether or not this is a hyperlink column (only possible for columns
  33. of type MEMO) */
  34. private boolean _hyperlink;
  35. MemoColumnImpl(InitArgs args) throws IOException
  36. {
  37. super(args);
  38. // co-located w/ precision/scale
  39. _sortOrder = readSortOrder(
  40. args.buffer, args.offset + getFormat().OFFSET_COLUMN_SORT_ORDER,
  41. getFormat());
  42. _codePage = readCodePage(args.buffer, args.offset, getFormat());
  43. _compressedUnicode =
  44. ((args.extFlags & COMPRESSED_UNICODE_EXT_FLAG_MASK) != 0);
  45. // only memo fields can be hyperlinks
  46. _hyperlink = ((args.flags & HYPERLINK_FLAG_MASK) != 0);
  47. }
  48. @Override
  49. public boolean isCompressedUnicode() {
  50. return _compressedUnicode;
  51. }
  52. @Override
  53. public short getTextCodePage() {
  54. return _codePage;
  55. }
  56. @Override
  57. public SortOrder getTextSortOrder() {
  58. return _sortOrder;
  59. }
  60. @Override
  61. public ColumnImpl getVersionHistoryColumn() {
  62. return _versionHistoryCol;
  63. }
  64. @Override
  65. public void setVersionHistoryColumn(ColumnImpl versionHistoryCol) {
  66. _versionHistoryCol = versionHistoryCol;
  67. }
  68. @Override
  69. public boolean isHyperlink() {
  70. return _hyperlink;
  71. }
  72. }