XmlIndexSpecification::addDefaultIndex

API Ref

#include <DbXml.hpp>

void XmlIndexSpecification::addDefaultIndex(const std::string &index)

void XmlIndexSpecification::addDefaultIndex(Type type, XmlValue::Type syntax)


Description: XmlIndexSpecification::addDefaultIndex

Adds an indexing strategy to the default index specification. That is, the index provided on this method is applied to all nodes in a container, except for those for which an explicit index is already declared. For more information on specifying indexing strategies, see XmlIndexSpecification::addIndex.


Description: void XmlIndexSpecification::addDefaultIndex(const std::string &index)

Adds one or more indexing strategies to the default index.

Parameters

index
A comma-separated list of strings that represent the indexing strategy. The strings must contain the following information in the following order:
unique-{path type}-{node type}-{key type}-{syntax}

where:

unique indicates that the indexed value is unique in the container. If this keyword does not appear on the index string, then the indexed value is not required to be unique in the container.

{path type} is either node or edge.

{node type} is one of element, attribute, or metadata. If metadata is specified, then {path type} must be node.

{key type} is one of presence, equality, or substring.

{syntax} identifies the type of information being indexed. It must be one of the following values:

  • none
  • base64Binary
  • boolean
  • date
  • dateTime
  • dayTimeDuration
  • decimal
  • double
  • duration
  • float
  • gDay
  • gMonth
  • gMonthDay
  • gYear
  • gYearMonth
  • hexBinary
  • string
  • time
  • yearMonthDuration
  • untypedAtomic

Note that if {key type} is presence, then {syntax} must be none or simply not specified.

For example, examples index strings are:

unique-node-element-presence
node-element-equality-string
edge-element-presence-none
node-element-equality-float

Errors

The XmlIndexSpecification::addDefaultIndex method may fail and throw XmlException, encapsulating one of the following non-zero errors:

UNKNOWN_INDEX
Unknown index specification

Description: void XmlIndexSpecification::addDefaultIndex(Type type, XmlValue::Type syntax)

Adds a single indexing strategy to the default index.

Parameters

type
A series of XmlIndexSpecification::Type values bitwise OR'd together to form the index strategy.

To indicate whether the indexed value must be unique container-wide, use one of the following, or leave the value out entirely:

  • XmlIndexSpecification::UNIQUE_OFF
  • XmlIndexSpecification::UNIQUE_ON

To identify the path type, use one of the following:

  • XmlIndexSpecification::PATH_NODE
  • XmlIndexSpecification::PATH_EDGE

To identify the node type, use one of the following:

  • XmlIndexSpecification::NODE_ELEMENT
  • XmlIndexSpecification::NODE_ATTRIBUTE
  • XmlIndexSpecification::NODE_METADATA

Note that if XmlIndexSpecification::NODE_METADATA is used, then XmlIndexSpecification::PATH_NODE must also be used as well.

To identify the key type, use one of the following:

  • XmlIndexSpecification::KEY_PRESENCE
  • XmlIndexSpecification::KEY_EQUALITY
  • XmlIndexSpecification::KEY_SUBSTRING

For example:

XmlIndexSpecification::PATH_NODE | XmlIndexSpecification::NODE_ELEMENT | XmlIndexSpecification::KEY_SUBSTRING
syntax

Identifies the type of information being indexed. The value must be one of the XmlValue enumerated types:

  • XmlValue::NONE
  • XmlValue::ANY_URI
  • XmlValue::BASE_64_BINARY
  • XmlValue::BOOLEAN
  • XmlValue::DATE
  • XmlValue::DATE_TIME
  • XmlValue::DAY_TIME_DURATION
  • XmlValue::DECIMAL
  • XmlValue::DOUBLE
  • XmlValue::DURATION
  • XmlValue::FLOAT
  • XmlValue::G_DAY
  • XmlValue::G_MONTH
  • XmlValue::G_MONTH_DAY
  • XmlValue::G_YEAR
  • XmlValue::G_YEAR_MONTH
  • XmlValue::HEX_BINARY
  • XmlValue::NOTATION
  • XmlValue::QNAME
  • XmlValue::STRING
  • XmlValue::TIME
  • XmlValue::YEAR_MONTH_DURATION
  • XmlValue::UNTYPED_ATOMIC
  • XmlValue::BINARY

Note that if XmlIndexSpecification::KEY_PRESENCE is specified for type, then this parameter must be XmlValue::NONE.

Errors

The XmlIndexSpecification::addDefaultIndex method may fail and throw XmlException, encapsulating one of the following non-zero errors:

UNKNOWN_INDEX
Unknown index specification

APIRef

Copyright (c) 1996,2007 Oracle. All rights reserved.