ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:dropindexsql

dropIndexSql

Syntax
array dropIndexSql(
    string $indexName,
    optional string $tableName=null,
    )

Description

The method dropIndexSql() creates the SQL statement necessary to drop an index, given by $indexName on an existing table, optionally given by $tableName. Some databases, where the index name is not unique, require the optional table name to be passed. When writing portable applications, best practice is to always pass the name of the table to the method. If not required, it will be ignored.

In order to actually delete the index, the returned array must be passed to the executeSqlArray() method.

Parameters

$indexName

An identifier for the index. The identifier must conform to any attributes designated by the DBMS, such as length and character set.

$tableName

If passed, The parameter must indicate an existing table in the database to which the index is attached.

Usage

$dict = NewDataDictionary($db);
$sqlarray = $dict->dropIndexSql('SALESIDX','ACT');
print_r($sqlarray);
/*
 * Second argument is ignored for DB2,
 * prints:
Array
(
    [0] => DROP INDEX SALESIDX
)
*/
$dict->executeSqlArray($sqlarray);
v5/dictionary/dropindexsql.txt · Last modified: 2016/01/13 02:06 by mnewnham