[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Plugins may load this file to gain access to special helper functions for plugin installation. This file is not included by WordPress and it is recommended, to prevent fatal errors, that this file is included using require_once. These functions are not optimized for speed, but they should only be used once in a while, so speed shouldn't be a concern. If it is and you are needing to use these functions a lot, you might experience timeouts. If you do, then it is advised to just write the SQL code yourself.
File Size: | 221 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
maybe_create_table( $table_name, $create_ddl ) X-Ref |
Creates a table in the database if it doesn't already exist. param: string $table_name Database table name. param: string $create_ddl SQL statement to create table. return: bool True on success or if the table already exists. False on failure. |
maybe_add_column( $table_name, $column_name, $create_ddl ) X-Ref |
Adds column to database table, if it doesn't already exist. param: string $table_name Database table name. param: string $column_name Table column name. param: string $create_ddl SQL statement to add column. return: bool True on success or if the column already exists. False on failure. |
maybe_drop_column( $table_name, $column_name, $drop_ddl ) X-Ref |
Drops column from database table, if it exists. param: string $table_name Database table name. param: string $column_name Table column name. param: string $drop_ddl SQL statement to drop column. return: bool True on success or if the column doesn't exist. False on failure. |
check_column( $table_name, $col_name, $col_type, $is_null = null, $key = null, $default_value = null, $extra = null ) X-Ref |
Checks that database table column matches the criteria. Uses the SQL DESC for retrieving the table info for the column. It will help understand the parameters, if you do more research on what column information is returned by the SQL statement. Pass in null to skip checking that criteria. Column names returned from DESC table are case sensitive and are as listed: - Field - Type - Null - Key - Default - Extra param: string $table_name Database table name. param: string $col_name Table column name. param: string $col_type Table column type. param: bool $is_null Optional. Check is null. param: mixed $key Optional. Key info. param: mixed $default_value Optional. Default value. param: mixed $extra Optional. Extra value. return: bool True, if matches. False, if not matching. |
Generated : Sat Jan 4 08:20:01 2025 | Cross-referenced by PHPXref |