Example #1
0
 /**
  * Alter the db table's collation
  *
  * @param   FabrikFEModelList $feModel       Front end list model
  * @param   string            $origCollation Original collection name
  * @param   JTable            $row           New collation
  *
  * @since   3.0.7
  *
  * @return boolean
  */
 protected function collation($feModel, $origCollation, $row)
 {
     // Don't attempt to alter new table, or a view, or if we shouldn't alter the table
     if ($row->get('id') == 0 || $feModel->isView() || !$feModel->canAlterFields()) {
         return false;
     }
     $params = new Registry($row->get('params'));
     $newCollation = $params->get('collation');
     if ($newCollation !== $origCollation) {
         $db = $feModel->getDb();
         $item = $feModel->getTable();
         $db->setQuery('ALTER TABLE ' . $item->db_table_name . ' COLLATE  ' . $newCollation);
         $db->execute();
     }
     return true;
 }