function drush_tripal_core_tripal_update_mview
2.x tripal_core.drush.inc | drush_tripal_core_tripal_update_mview() |
3.x tripal_core.drush.inc | drush_tripal_core_tripal_update_mview() |
1.x tripal_core.drush.inc | drush_tripal_core_tripal_update_mview() |
DEPRECATED. Updates the specified materialized view.
Related topics
File
- legacy/
tripal_core/ tripal_core.drush.inc, line 229 - Contains function relating to drush-integration of this module.
Code
function drush_tripal_core_tripal_update_mview() {
$mview_id = drush_get_option('mview_id');
$table_name = drush_get_option('table_name');
drush_print("\n\nDEPRECATED: This drush command is outdated.\nIt will " .
"continue to work but please consider using the 'trp-refresh-mview' command.\n\n");
// Either table_name or mview is required
if (!$mview_id) {
if ($table_name) {
// if table_name supplied use that to get mview_id
$sql = "SELECT mview_id FROM {tripal_mviews} WHERE mv_table = :mv_table";
$results = db_query($sql, array(':mv_table' => $table_name));
$r = $resuls->fetchObject();
if (!$r->mview_id) {
drush_set_error('No Materialized View associated with that table_name.');
}
$mview_id = $r->mview_id;
}
else {
drush_set_error('Either mview_id OR table_name are required.');
}
}
drush_print('Updating the Materialized View with ID=' . $mview_id);
$status = tripal_populate_mview($mview_id);
if ($status) {
drush_log('Materialized View Updated', 'ok');
}
else {
drush_set_error('Update failed.');
}
}