(unimarc specific) BUGFIX : if 100$a exist but is not 35 char long, MARC::File::XML...
[koha_gimpoz] / misc / migration_tools / 22_to_30 / convert_to_utf8.pl
1 #!/usr/bin/perl
2
3 # small script to convert mysql tables to utf-8
4
5 use C4::Context;
6 use strict;
7
8 my $dbh=C4::Context->dbh();
9
10 my $database=C4::Context->config("database");
11 my $query="Show tables";
12 my $sth=$dbh->prepare($query);
13 $sth->execute();
14 while (my @table=$sth->fetchrow_array()){
15     print "Altering table $table[0]\n";
16     my $alter_query="ALTER TABLE $table[0] convert to CHARACTER SET UTF8 collate utf8_general_ci";
17     my $sth2=$dbh->prepare($alter_query);
18     $sth2->execute();
19     $sth2->finish();
20
21 }
22 $sth->finish();
23 $dbh->disconnect();