tools_interface
interface tools_interface
Interface for a Database Tools for handling cross-db actions such as altering columns, etc.
Methods
Handle passed database update array.
Gets a list of tables in the database.
Check if table exists
Create SQL Table
Drop Table
Gets a list of columns of a table.
Check whether a specified column exist in a table
Add new column
Change column type (not name!)
Drop column
List all of the indices that belong to a table
Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.
Add index
Drop Index
Check if a specified index exists in table.
Add unique index
Add primary key
Details
at line 46
bool|string[]
perform_schema_changes(array $schema_changes)
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}), )
at line 53
array
sql_list_tables()
Gets a list of tables in the database.
at line 62
bool
sql_table_exists(string $table_name)
Check if table exists
at line 72
bool|string[]
sql_create_table(string $table_name, array $table_data)
Create SQL Table
at line 81
bool|string[]
sql_table_drop(string $table_name)
Drop Table
at line 90
array
sql_list_columns(string $table_name)
Gets a list of columns of a table.
at line 100
bool
sql_column_exists(string $table_name, string $column_name)
Check whether a specified column exist in a table
at line 111
bool|string[]
sql_column_add(string $table_name, string $column_name, array $column_data)
Add new column
at line 122
bool|string[]
sql_column_change(string $table_name, string $column_name, array $column_data)
Change column type (not name!)
at line 132
bool|string[]
sql_column_remove(string $table_name, string $column_name)
Drop column
at line 145
array
sql_list_index(string $table_name)
List all of the indices that belong to a table
NOTE: does not list
- UNIQUE indices
- PRIMARY keys
at line 155
bool
sql_index_exists(string $table_name, string $index_name)
Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes.
at line 166
bool|string[]
sql_create_index(string $table_name, string $index_name, string|array $column)
Add index
at line 176
bool|string[]
sql_index_drop(string $table_name, string $index_name)
Drop Index
at line 188
bool|string[]
sql_unique_index_exists(string $table_name, string $index_name)
Check if a specified index exists in table.
NOTE: Does not return normal and PRIMARY KEY indexes
at line 199
bool|string[]
sql_create_unique_index(string $table_name, string $index_name, string|array $column)
Add unique index
at line 209
bool|string[]
sql_create_primary_key(string $table_name, string|array $column)
Add primary key