[+/-]
Index
Class ConstructorIndex::getName()
Index::getTable()
Index::getNoOfColumns()
Index::getColumn()
Index::getType()
Index::getLogging()
Index::getObjectStatus()
Index::getObjectVersion()
Index::getObjectId()
Index::setName()
Index::setTable()
Index::addColumn()
Index::addColumnName()
Index::addColumnNames()
Index::setType()
Index::setLogging
Abstract
This section contain descriptions of all public methods of the
Index
class. This class has relatively few
methods (compared to, say, Table
), which are
fairly straightforward to use.
If you create or change indexes using the NDB
API, these modifications cannot be seen by MySQL. The only
exception to this is renaming the index using
Index::setName()
.
Description.
This is used to create an new instance of
Index
.
Indexes created using the NDB API cannot be seen by the MySQL Server.
Signature.
Index
(
const char* name
= ""
)
Parameters.
The name of the new index. It is possible to create an index
without a name, and then assign a name to it later using
setName()
. See
Section 2.3.5.2.11, “Index::setName()
”.
Return value.
A new instance of Index
.
Destructor.
The destructor (~Index()
) is supplied as a
virtual method.
Description. This method is used to obtain the name of an index.
Signature.
const char* getName ( void ) const
Parameters. None.
Return value. The name of the index, as a constant character pointer.
Description. This method can be used to obtain the name of the table to which the index belongs.
Signature.
const char* getTable ( void ) const
Parameters. None.
Return value. The name of the table, as a constant character pointer.
Description. This method is used to obtain the number of columns making up the index.
Signature.
unsigned getNoOfColumns ( void ) const
Parameters. None.
Return value. An unsigned integer representing the number of columns in the index.
Description. This method retrieves the column at the specified position within the index.
Signature.
const Column* getColumn
(
unsigned no
) const
Parameters.
The ordinal position number no
of
the column, as an unsigned integer. Use the
getNoOfColumns()
method to determine how
many columns make up the index — see
Section 2.3.5.2.4, “Index::getNoOfColumns()
”, for details.
Return value.
The column having position no
in
the index, as a pointer to an instance of
Column
. See Section 2.3.1, “The Column
Class”.
Description. This method can be used to find the type of index.
Signature.
Type getType ( void ) const
Parameters. None.
Return value.
An index type. See Section 2.3.5.1, “The Index::Type
Type”, for
possible values.
Description. Use this method to determine whether logging to disk has been enabled for the index.
Indexes which are not logged are rebuilt when the cluster is started or restarted.
Ordered indexes currently do not support logging to disk; they are rebuilt each time the cluster is started. (This includes restarts.)
Signature.
bool getLogging ( void ) const
Parameters. None.
Return value. A Boolean value:
true
: The index is being logged to
disk.
false
: The index is not being logged.
Description. This method gets the object status of the index.
Signature.
virtual Object::Status getObjectStatus ( void ) const
Parameters. None.
Return value.
A Status
value — see
Section 2.3.20.1.3, “The Object::Status
Type”, for more information.
Description. This method gets the object version of the index.
Signature.
virtual int getObjectVersion ( void ) const
Parameters. None.
Return value. The object version for the index, as an integer.
Description. This method is used to obtain the object ID of the index.
Signature.
virtual int getObjectId ( void ) const
Parameters. None.
Return value. The object ID, as an integer.
Description. This method sets the name of the index.
This is the only
Index::set
method whose result is visible to a MySQL Server.
*
()
Signature.
void setName
(
const char* name
)
Parameters.
The desired name
for the index, as
a constant character pointer.
Return value. None.
Description. This method sets the table that is to be indexed. The table is referenced by name.
Signature.
void setTable
(
const char* name
)
Parameters.
The name
of the table to be
indexed, as a constant character pointer.
Return value. None.
Description. This method may be used to add a column to an index.
The order of the columns matches the order in which they are added to the index. However, this matters only with ordered indexes.
Signature.
void addColumn
(
const Column& c
)
Parameters.
A reference c
to the column which
is to be added to the index.
Return value. None.
Description.
This method works in the same way as
addColumn()
, except that it takes the name
of the column as a parameter. See
Section 2.3.5.2.5, “Index::getColumn()
”.
Signature.
void addColumnName
(
const char* name
)
Parameters.
The name
of the column to be added
to the index, as a constant character pointer.
Return value. None.
Description. This method is used to add several column names to an index definition at one time.
As with the addColumn()
and
addColumnName()
methods, the indexes are
numbered in the order in which they were added. (However, this
matters only for ordered indexes.)
Signature.
void addColumnNames ( unsignednoOfNames
, const char**names
)
Parameters. This method takes two parameters:
The number of columns/names
noOfNames
to be added to the
index.
The names
to be added (as a
pointer to a pointer).
Return value. None.
Description. This method is used to set the index type.
Signature.
void setType
(
Type type
)
Parameters.
The type
of index. For possible
values, see Section 2.3.5.1, “The Index::Type
Type”.
Return value. None.
Description. This method is used to enable or disable logging of the index to disk.
Signature.
void setLogging
(
bool enable
)
Parameters.
setLogging()
takes a single Boolean
parameter enable
. If
enable
is true
,
then logging is enabled for the index; if false, then logging
of this index is disabled.
Return value. None.