Skip to content

Commit

Permalink
Another fix to make collation fixing faster
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/stable_plus@3353 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Oct 7, 2007
1 parent 586cbcf commit acaa424
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions admin/install/upgrade-mysql.php
Expand Up @@ -122,22 +122,25 @@ function fix_mysql_collation()
}

# Now loop through all the fields within this table
$result2 = db_execute_assoc("SHOW FULL COLUMNS FROM ".$table." WHERE COLLATION <> 'utf8_unicode_ci'");
$result2 = db_execute_assoc("SHOW FULL COLUMNS FROM ".$table);
while ( $column = $result2->FetchRow())
{
$field_name = $column['Field'];
$field_type = $column['Type'];

# Change text based fields
$skipped_field_types = array('char', 'text', 'enum', 'set');

foreach ( $skipped_field_types as $type )
{
if ( strpos($field_type, $type) !== false )
{
modify_database("","ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_unicode_ci");
echo $modifyoutput; flush();
}
if ($column['Collation']!= 'utf8_unicode_ci' )
{
$field_name = $column['Field'];
$field_type = $column['Type'];

# Change text based fields
$skipped_field_types = array('char', 'text', 'enum', 'set');

foreach ( $skipped_field_types as $type )
{
if ( strpos($field_type, $type) !== false )
{
modify_database("","ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_unicode_ci");
echo $modifyoutput; flush();
}
}
}
}
}
Expand Down

0 comments on commit acaa424

Please sign in to comment.