Firebird News

Friday, March 17, 2006

We got some opencms mysql dump (from an windows machine) and all tables
are created with Uppercase Chars but on our db server (debian stable ) mysql creates
al database files (thouse under /var/lib/mysql/exampledb ) with small chars
So i wrote 2 scripts for converting the files

#cd /var/lib/mysql/exampledb

create an script with this content

for i in *.myi *.frm *.myd
echo $i
mv $i `echo $i | tr "[a-z]" "[A-Z]"`
run it


then create another perl script

with this content
foreach $name ( @ARGV ) {
@splitedname = split(/\./, $name);
#print "@splitedname\n";
$filename = $splitedname[0];
$extension = "frm";
$newname = "$filename.$extension";
# $newname =~ tr/A-Z/a-z/;
print "$name becomes $newname\n";
rename ($name, $newname) if ($newname ne $name );
and run it

#perl *.FRM

ps: it was wrote in rush so i know it can be done better :)

Post a Comment