ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:metaindexes

This is an old revision of the document!


metaIndexes

See Also

metaPrimaryKeys()

Syntax
  mixed metaIndexes(
      string $tableName,
      optional bool $primary=true,
      optional string $owner=false,
      )

Description

The function metaIndexes() returns a list of indexes associated with a specific table. All drivers return the same array of data. There are no database-specific entries. The array of data is as followed:

[index_name] => Array
        (
            [unique] => 0
            [columns] => Array
                (
                    [0] => Column 1
                    [1] => Column 2
                    [2] => etc........
                )
 
        )

The casing of metaIndexes is returned in the native mode for the database, you should not assume the casing for the returned data.

Optional Parameters

$primary

If set, only returns the index associated with the primary key

$owner

If specified, only returns indexes associated with a table owned by that name. Support for this function is limited, see the compatibility matrix.

Usage

/*
 * Database connection to DB2 database sample assumed
 */
$mi = $db->metaIndexes('ACT');
print_r($mi);
/*
 * Returns
Array
(
    [PK_ACT] => Array
        (
            [unique] => 0
            [columns] => Array
                (
                    [0] => ACTNO
                )
 
        )
 
    [XACT2] => Array
        (
            [unique] => 0
            [columns] => Array
                (
                    [0] => ACTNO
                    [1] => ACTKWD
                )
 
        )
 
)
*/
v5/dictionary/metaindexes.1439337938.txt.gz · Last modified: 2017/04/21 11:27 (external edit)