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.

Index.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Copyright (c) 2013 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;
  14. import java.io.IOException;
  15. import java.util.List;
  16. /**
  17. * Access database index definition. A {@link Table} has a list of Index
  18. * instances. Indexes can enable fast searches and ordered traversal on a
  19. * Table (for the indexed columns). These features can be utilized via an
  20. * {@link IndexCursor}.
  21. *
  22. * @author James Ahlborn
  23. * @usage _general_class_
  24. */
  25. public interface Index
  26. {
  27. public Table getTable();
  28. public String getName();
  29. public boolean isPrimaryKey();
  30. public boolean isForeignKey();
  31. /**
  32. * @return the Columns for this index (unmodifiable)
  33. */
  34. public List<? extends Index.Column> getColumns();
  35. /**
  36. * @return the Index referenced by this Index's ForeignKeyReference (if it
  37. * has one), otherwise {@code null}.
  38. */
  39. public Index getReferencedIndex() throws IOException;
  40. /**
  41. * Whether or not {@code null} values are actually recorded in the index.
  42. */
  43. public boolean shouldIgnoreNulls();
  44. /**
  45. * Whether or not index entries must be unique.
  46. * <p>
  47. * Some notes about uniqueness:
  48. * <ul>
  49. * <li>Access does not seem to consider multiple {@code null} entries
  50. * invalid for a unique index</li>
  51. * <li>text indexes collapse case, and Access seems to compare <b>only</b>
  52. * the index entry bytes, therefore two strings which differ only in
  53. * case <i>will violate</i> the unique constraint</li>
  54. * </ul>
  55. */
  56. public boolean isUnique();
  57. /**
  58. * Convenience method for constructing a new CursorBuilder for this Index.
  59. */
  60. public CursorBuilder newCursor();
  61. /**
  62. * Information about a Column in an Index
  63. */
  64. public interface Column {
  65. public com.healthmarketscience.jackcess.Column getColumn();
  66. public boolean isAscending();
  67. public int getColumnIndex();
  68. public String getName();
  69. }
  70. }