I have problems trying to change engine on prefixed tables; $db_prefix should be set to '' while changing the engines:

function dbtuner_engine_configuration_submit($form, &$form_state) {
  $engine = $form_state['values']['db_engine'];
  $tables = db_query('SHOW TABLE STATUS');
  $counter = 0;
  global $db_prefix;
  $prefix_backup = $db_prefix;
  $db_prefix='';
  while ($table = db_fetch_array($tables)) {
    if ($table['Engine'] != $engine) {
      db_query('ALTER TABLE {%s} ENGINE = %s', $table['Name'], $engine);
      $counter++;
    }
  }
  $db_prefix = $prefix_backup;
  drupal_set_message(t('@count tables changed to @name', array('@count' => $counter, '@name' => $engine)));
}
CommentFileSizeAuthor
#1 dbtuner-797072.patch710 bytesmikeytown2

Comments

mikeytown2’s picture

Status: Active » Needs review
StatusFileSize
new710 bytes

try this

mikeytown2’s picture

Status: Needs review » Fixed

pretty sure my patch will fix it.
committed

enboig’s picture

I agree your solution is far more simple; tested it and it works.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.