XMF Cookbook
  • Introduction
  • XMF Cookbook
  • Basic Ingredients
    • Namespaces
    • Autoloading
    • Debugging
    • Forward Compatibility
  • Recipes
    • Introducing Module Helpers
    • Using the Permission Helper
      • Checking Permissions
      • Managing Item Permissions
    • Using the Session Helper
    • Using JSON Web Tokens
    • Altering Database Tables
    • Migrating a Module's Database
    • Loading Initial Data
    • Module Admin Pages
      • Hide and Seek with Icons
      • Standard Admin Pages
    • Manage Metadata
    • Highlighting Content
  • Reference
    • Assert
      • Assertions
    • Database
      • Migrate
      • TableLoad
      • Tables
        • Getting Started
        • Table Operations
        • Working with Columns
        • Working with Indexes
        • Changing Table Data
        • Interacting with the Work Queue
        • Error Info and Debugging
    • Debug
    • FilterInput
    • Highlighter
    • IPAddress
    • Jwt
      • JsonWebToken
      • KeyFactory
      • TokenFactory
      • TokenReader
    • Key
      • ArrayStorage
      • Basic
      • FileStorage
      • KeyAbstract
      • StorageInterface
    • Language
    • Metagen
      • Extracting Data
      • Applying Data
    • Module
      • Admin
      • Helper
      • Helper
        • AbstractHelper
        • Cache
        • GenericHelper
        • Permission
        • Session
    • ProxyCheck
    • Random
    • Request
    • StopWords
    • Uuid
    • Yaml
  • Credits
  • License:
  • Table of Content
Powered by GitBook
On this page
  • getTableIndexes($table)
  • addPrimaryKey($table, $column)
  • addIndex($name, $table, $column, $unique)
  • dropIndex($name, $table)
  • dropIndexes($table)
  • dropPrimaryKey($table)
  1. Reference
  2. Database
  3. Tables

Working with Indexes

PreviousWorking with ColumnsNextChanging Table Data

Last updated 6 years ago

getTableIndexes($table)

Get an array of indexes defined on $table

Each array entry is in the form:

    'indexname' => array(
        'columns' => 'column1, column2',
        'unique' => false
    )

Returns an array of indexes on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

addPrimaryKey($table, $column)

Queue instruction needed to add new primary key definition ($column) for $table to the work queue. The $column string may be a single column name or a comma separated list of column names. A must be unique.

Returns true on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

addIndex($name, $table, $column, $unique)

Queue instruction needed to create a new index named $name to $table with definition $column to the work queue. The $column string may be a single column name or a comma separated list of column names. If $unique is specified as true, the index will be specified as unique.

Returns true on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

dropIndex($name, $table)

Queue instruction needed to drop the index named $name on $table to the work queue.

Returns true on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

dropIndexes($table)

Add drop index for all (non-PRIMARY) keys for a $table to the work queue. This can be used to clean up indexes with automatically generated names.

Returns true on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

dropPrimaryKey($table)

Queue instruction needed to drop the primary key definition on $table to the work queue.

Returns true on success, or false on error. Additional information may be available using getLastError() and getLastErrNo().

primary key