[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/db/tools/ -> tools_interface.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\db\tools;
  15  
  16  /**
  17   * Interface for a Database Tools for handling cross-db actions such as altering columns, etc.
  18   */
  19  interface tools_interface
  20  {
  21      /**
  22       * Handle passed database update array.
  23       * Expected structure...
  24       * Key being one of the following
  25       *    drop_tables: Drop tables
  26       *    add_tables: Add tables
  27       *    change_columns: Column changes (only type, not name)
  28       *    add_columns: Add columns to a table
  29       *    drop_keys: Dropping keys
  30       *    drop_columns: Removing/Dropping columns
  31       *    add_primary_keys: adding primary keys
  32       *    add_unique_index: adding an unique index
  33       *    add_index: adding an index (can be column:index_size if you need to provide size)
  34       *
  35       * The values are in this format:
  36       *        {TABLE NAME}        => array(
  37       *            {COLUMN NAME}        => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}),
  38       *            {KEY/INDEX NAME}    => array({COLUMN NAMES}),
  39       *        )
  40       *
  41       *
  42       * @param array $schema_changes
  43       * @return null
  44       */
  45  	public function perform_schema_changes($schema_changes);
  46  
  47      /**
  48       * Gets a list of tables in the database.
  49       *
  50       * @return array        Array of table names  (all lower case)
  51       */
  52  	public function sql_list_tables();
  53  
  54      /**
  55       * Check if table exists
  56       *
  57       * @param string    $table_name    The table name to check for
  58       * @return bool true if table exists, else false
  59       */
  60  	public function sql_table_exists($table_name);
  61  
  62      /**
  63       * Create SQL Table
  64       *
  65       * @param string    $table_name        The table name to create
  66       * @param array        $table_data        Array containing table data.
  67       * @return array|true    Statements to run, or true if the statements have been executed
  68       */
  69  	public function sql_create_table($table_name, $table_data);
  70  
  71      /**
  72       * Drop Table
  73       *
  74       * @param string    $table_name        The table name to drop
  75       * @return array|true    Statements to run, or true if the statements have been executed
  76       */
  77  	public function sql_table_drop($table_name);
  78  
  79      /**
  80       * Gets a list of columns of a table.
  81       *
  82       * @param string $table_name    Table name
  83       * @return array        Array of column names (all lower case)
  84       */
  85  	public function sql_list_columns($table_name);
  86  
  87      /**
  88       * Check whether a specified column exist in a table
  89       *
  90       * @param string    $table_name        Table to check
  91       * @param string    $column_name    Column to check
  92       * @return bool        True if column exists, false otherwise
  93       */
  94  	public function sql_column_exists($table_name, $column_name);
  95  
  96      /**
  97       * Add new column
  98       *
  99       * @param string    $table_name        Table to modify
 100       * @param string    $column_name    Name of the column to add
 101       * @param array        $column_data    Column data
 102       * @param bool        $inline            Whether the query should actually be run,
 103       *                        or return a string for adding the column
 104       * @return array|true    Statements to run, or true if the statements have been executed
 105       */
 106  	public function sql_column_add($table_name, $column_name, $column_data, $inline = false);
 107  
 108      /**
 109       * Change column type (not name!)
 110       *
 111       * @param string    $table_name        Table to modify
 112       * @param string    $column_name    Name of the column to modify
 113       * @param array        $column_data    Column data
 114       * @param bool        $inline            Whether the query should actually be run,
 115       *                        or return a string for modifying the column
 116       * @return array|true    Statements to run, or true if the statements have been executed
 117       */
 118  	public function sql_column_change($table_name, $column_name, $column_data, $inline = false);
 119  
 120      /**
 121       * Drop column
 122       *
 123       * @param string    $table_name        Table to modify
 124       * @param string    $column_name    Name of the column to drop
 125       * @param bool        $inline            Whether the query should actually be run,
 126       *                        or return a string for deleting the column
 127       * @return array|true    Statements to run, or true if the statements have been executed
 128       */
 129  	public function sql_column_remove($table_name, $column_name, $inline = false);
 130  
 131      /**
 132       * List all of the indices that belong to a table
 133       *
 134       * NOTE: does not list
 135       * - UNIQUE indices
 136       * - PRIMARY keys
 137       *
 138       * @param string    $table_name        Table to check
 139       * @return array        Array with index names
 140       */
 141  	public function sql_list_index($table_name);
 142  
 143      /**
 144       * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.
 145       *
 146       * @param string    $table_name        Table to check the index at
 147       * @param string    $index_name        The index name to check
 148       * @return bool            True if index exists, else false
 149       */
 150  	public function sql_index_exists($table_name, $index_name);
 151  
 152      /**
 153       * Add index
 154       *
 155       * @param string    $table_name        Table to modify
 156       * @param string    $index_name        Name of the index to create
 157       * @param string|array    $column        Either a string with a column name, or an array with columns
 158       * @return array|true    Statements to run, or true if the statements have been executed
 159       */
 160  	public function sql_create_index($table_name, $index_name, $column);
 161  
 162      /**
 163       * Drop Index
 164       *
 165       * @param string    $table_name        Table to modify
 166       * @param string    $index_name        Name of the index to delete
 167       * @return array|true    Statements to run, or true if the statements have been executed
 168       */
 169  	public function sql_index_drop($table_name, $index_name);
 170  
 171      /**
 172       * Check if a specified index exists in table.
 173       *
 174       * NOTE: Does not return normal and PRIMARY KEY indexes
 175       *
 176       * @param string    $table_name        Table to check the index at
 177       * @param string    $index_name        The index name to check
 178       * @return bool True if index exists, else false
 179       */
 180  	public function sql_unique_index_exists($table_name, $index_name);
 181  
 182      /**
 183       * Add unique index
 184       *
 185       * @param string    $table_name        Table to modify
 186       * @param string    $index_name        Name of the unique index to create
 187       * @param string|array    $column        Either a string with a column name, or an array with columns
 188       * @return array|true    Statements to run, or true if the statements have been executed
 189       */
 190  	public function sql_create_unique_index($table_name, $index_name, $column);
 191  
 192      /**
 193       * Add primary key
 194       *
 195       * @param string    $table_name        Table to modify
 196       * @param string|array    $column        Either a string with a column name, or an array with columns
 197       * @param bool        $inline            Whether the query should actually be run,
 198       *                        or return a string for creating the key
 199       * @return array|true    Statements to run, or true if the statements have been executed
 200       */
 201  	public function sql_create_primary_key($table_name, $column, $inline = false);
 202  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1