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
  • addColumn($table, $column, $attributes)
  • alterColumn($table, $column, $attributes, $newName)
  • getColumnAttributes($table, $column)
  • dropColumn($table, $column)
  1. Reference
  2. Database
  3. Tables

Working with Columns

addColumn($table, $column, $attributes)

Add to the work queue instruction needed to add a column, named $column, with specified $attributes to $table.

The attributes as specified as a string, i.e. "VARCHAR(32) NOT NULL DEFAULT ''".

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

alterColumn($table, $column, $attributes, $newName)

Add to the work queue instruction needed to alter an existing column, named $column, on $table with specified $attributes. If $newName is supplied, the column will be renamed as specified in $newName.

The attributes as specified as a string, i.e. "VARCHAR(32) NOT NULL DEFAULT ''".

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

getColumnAttributes($table, $column)

Get the current attributes an existing column, named $column, on $table.

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

dropColumn($table, $column)

Add to the work queue instruction needed to drop an existing column, named $column, on $table.

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

PreviousTable OperationsNextWorking with Indexes

Last updated 6 years ago