- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

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/12 17:06 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top