February 12, 2011 1:43 am
Definition:
function maybe_drop_column($table_name, $column_name, $drop_ddl) {}
returns:False on failure, true on success or doesn’t exist.
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
global $wpdb;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
//found it try to drop it.
$wpdb->query($drop_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
return false;
}
}
}
}
// else didn't find it
return true;
}
2333
Posted by Thorsten
Categories: /wp-admin/install-helper.php, Documentation, Files, Functions, Functions by letter m
Tags: idd1fe61efd2b7cc0c6dcca1a4a6555259, maybe_drop_column
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.