====== dropIndexSql ======
~~NOTOC~~
== 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 [[v5:dictionary:executesqlarray|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);