Index Service

From Apache OpenOffice Wiki
Jump to: navigation, search



The Index service encapsulates indexes at a table object. An index is described through the properties Name, Catalog, IsUnique, IsPrimaryKeyIndex, and IsClustered. All properties are read-only if an index has not been added to a tables index container. The last three properties are boolean values that indicate an index object only allows unique values, is used for the primary key, and if it is clustered. The property IsPrimaryKeyIndex is only available after the index has been created because it defines a special index that is created by the database while creating a primary key for a table object. Not all databases currently available in OpenOffice.org API support primary keys.

Index

The following code fragment displays the properties of a given index object:

  // index properties
  public static void printIndexProperties(Object index) throws Exception, SQLException {
      System.out.println("Example printIndexProperties");
      XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, index);
      System.out.println("Name: " + xProp.getPropertyValue("Name"));
      System.out.println("Catalog: " + xProp.getPropertyValue("Catalog"));
      System.out.println("IsUnique: " + xProp.getPropertyValue("IsUnique"));
      System.out.println("IsPrimaryKeyIndex: " + xProp.getPropertyValue("IsPrimaryKeyIndex"));
      System.out.println("IsClustered: " + xProp.getPropertyValue("IsClustered"));
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages