[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/db/ -> tools.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 2840 lines (78 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

tools:: (28 methods):
  get_dbms_type_map()
  __construct()
  set_return_statements()
  sql_list_tables()
  sql_table_exists()
  sql_create_table()
  perform_schema_changes()
  sql_list_columns()
  sql_column_exists()
  sql_index_exists()
  sql_unique_index_exists()
  _sql_run_sql()
  sql_prepare_column_data()
  get_column_type()
  sql_column_add()
  sql_column_remove()
  sql_index_drop()
  sql_table_drop()
  sql_create_primary_key()
  sql_create_unique_index()
  sql_create_index()
  sql_list_index()
  strip_table_name_from_index_name()
  sql_column_change()
  mssql_get_drop_default_constraints_queries()
  get_existing_indexes()
  mssql_is_sql_server_2000()
  sqlite_get_recreate_table_queries()


Class: tools  - X-Ref

Database Tools for handling cross-db actions such as altering columns, etc.
Currently not supported is returning SQL for creating tables.

get_dbms_type_map()   X-Ref
Get the column types for every database we support

return: array

__construct(\phpbb\db\driver\driver_interface $db, $return_statements = false)   X-Ref
Constructor. Set DB Object and set {@link $return_statements return_statements}.

param: \phpbb\db\driver\driver_interface    $db                    Database connection
param: bool        $return_statements    True if only statements should be returned and no SQL being executed

set_return_statements($return_statements)   X-Ref
Setter for {@link $return_statements return_statements}.

param: bool $return_statements True if SQL should not be executed but returned as strings
return: null

sql_list_tables()   X-Ref
Gets a list of tables in the database.

return: array        Array of table names  (all lower case)

sql_table_exists($table_name)   X-Ref
Check if table exists

param: string    $table_name    The table name to check for
return: bool true if table exists, else false

sql_create_table($table_name, $table_data)   X-Ref
Create SQL Table

param: string    $table_name    The table name to create
param: array    $table_data    Array containing table data.
return: array    Statements if $return_statements is true.

perform_schema_changes($schema_changes)   X-Ref
Handle passed database update array.
Expected structure...
Key being one of the following
drop_tables: Drop tables
add_tables: Add tables
change_columns: Column changes (only type, not name)
add_columns: Add columns to a table
drop_keys: Dropping keys
drop_columns: Removing/Dropping columns
add_primary_keys: adding primary keys
add_unique_index: adding an unique index
add_index: adding an index (can be column:index_size if you need to provide size)

The values are in this format:
{TABLE NAME}        => array(
{COLUMN NAME}        => array({COLUMN TYPE}, {DEFAULT VALUE}, {OPTIONAL VARIABLES}),
{KEY/INDEX NAME}    => array({COLUMN NAMES}),
)

For more information have a look at /develop/create_schema_files.php (only available through SVN)

sql_list_columns($table)   X-Ref
Gets a list of columns of a table.

param: string $table        Table name
return: array                Array of column names (all lower case)

sql_column_exists($table, $column_name)   X-Ref
Check whether a specified column exist in a table

param: string    $table            Table to check
param: string    $column_name    Column to check
return: bool        True if column exists, false otherwise

sql_index_exists($table_name, $index_name)   X-Ref
Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.

param: string    $table_name        Table to check the index at
param: string    $index_name        The index name to check
return: bool True if index exists, else false

sql_unique_index_exists($table_name, $index_name)   X-Ref
Check if a specified index exists in table. Does not return PRIMARY KEY indexes.

param: string    $table_name        Table to check the index at
param: string    $index_name        The index name to check
return: bool True if index exists, else false

_sql_run_sql($statements)   X-Ref
Private method for performing sql statements (either execute them or return them)


sql_prepare_column_data($table_name, $column_name, $column_data)   X-Ref
Function to prepare some column information for better usage


get_column_type($column_map_type)   X-Ref
Get the column's database type from the type map

param: string $column_map_type
return: array        column type for this database

sql_column_add($table_name, $column_name, $column_data, $inline = false)   X-Ref
Add new column


sql_column_remove($table_name, $column_name, $inline = false)   X-Ref
Drop column


sql_index_drop($table_name, $index_name)   X-Ref
Drop Index


sql_table_drop($table_name)   X-Ref
Drop Table


sql_create_primary_key($table_name, $column, $inline = false)   X-Ref
Add primary key


sql_create_unique_index($table_name, $index_name, $column)   X-Ref
Add unique index


sql_create_index($table_name, $index_name, $column)   X-Ref
Add index


sql_list_index($table_name)   X-Ref
List all of the indices that belong to a table,
does not count:
* UNIQUE indices
* PRIMARY keys


strip_table_name_from_index_name($table_name, $index_name)   X-Ref
Removes table_name from the index_name if it is at the beginning

param: $table_name
param: $index_name
return: string

sql_column_change($table_name, $column_name, $column_data, $inline = false)   X-Ref
Change column type (not name!)


mssql_get_drop_default_constraints_queries($table_name, $column_name)   X-Ref
Get queries to drop the default constraints of a column

We need to drop the default constraints of a column,
before being able to change their type or deleting them.

param: string $table_name
param: string $column_name
return: array        Array with SQL statements

get_existing_indexes($table_name, $column_name, $unique = false)   X-Ref
Get a list with existing indexes for the column

param: string $table_name
param: string $column_name
param: bool $unique Should we get unique indexes or normal ones
return: array        Array with Index name => columns

mssql_is_sql_server_2000()   X-Ref
Is the used MS SQL Server a SQL Server 2000?

return: bool

sqlite_get_recreate_table_queries($table_name, $remove_column = '')   X-Ref
Returns the Queries which are required to recreate a table including indexes

param: string $table_name
param: string $remove_column    When we drop a column, we remove the column
return: array



Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1