man Alzabo::Create::Index () - Index objects for schema creation

NAME

Alzabo::Create::Index - Index objects for schema creation

SYNOPSIS

  use Alzabo::Create::Index;

DESCRIPTION

This object represents an index on a table. Indexes consist of columns and optional prefixes for each column. The prefix specifies how many characters of the columns should be indexes (the first X chars). Some RDBMS's do not have a concept of index prefixes. Not all column types are likely to allow prefixes though this depends on the RDBMS. The order of the columns is significant.

INHERITS FROM

CWAlzabo::Index

Note: all relevant documentation from the superclass has been merged into this document.

METHODS

new

The constructor takes the following parameters: The table that this index is indexing. This parameter indicates which columns that are being indexed. It can either be an array reference of column objects, or an array reference of hash references, each with a key called column and one called prefix. The prefix key is optional. Indicates whether or not this is a unique index. Indicates whether or not this is a fulltext index.

Returns a new CWAlzabo::Create::Index object.

Throws: CWAlzabo::Exception::Params, CWAlzabo::Exception::RDBMSRules

table

Returns the CWAlzabo::Create::Table object to which the index belongs.

columns

Returns an ordered list of the CWAlzabo::Create::Column objects that are being indexed.

add_column

Adds a column to the index.

This method takes the following parameters:

Throws: CWAlzabo::Exception::Params, CWAlzabo::Exception::RDBMSRules Deletes the given column from the index.

Throws: CWAlzabo::Exception::Params, CWAlzabo::Exception::RDBMSRules A column prefix is, to the best of my knowledge, a MySQL specific concept, and as such cannot be set when using an RDBMSRules module for a different RDBMS. However, it is important enough for MySQL to have the functionality be present. It allows you to specify that the index should only look at a certain portion of a field (the first N characters). This prefix is required to index any sort of BLOB column in MySQL.

This method returns the prefix for the column in the index. If there is no prefix for this column in the index, then it returns undef.

set_prefix

This method takes the following parameters:

Throws: CWAlzabo::Exception::Params, CWAlzabo::Exception::RDBMSRules

unique

Returns a boolean value indicating whether the index is a unique index.

set_unique ($boolean)

Sets whether or not the index is a unique index.

fulltext

Returns a boolean value indicating whether the index is a fulltext index.

set_fulltext ($boolean)

Set whether or not the index is a fulltext index.

Throws: CWAlzabo::Exception::Params, CWAlzabo::Exception::RDBMSRules

register_column_name_change

This method takes the following parameters: The column (with the new name already set).

This method is called by the table object which owns the index when a column name changes. You should never need to call this yourself.

Throws: CWAlzabo::Exception::Params

id

The id is generated from the table, column and prefix information for the index. This is useful as a canonical name for a hash key, for example.

Returns a string that is the id which uniquely identifies the index in this schema.

AUTHOR

Dave Rolsky, <autarch@urth.org>