
print <<SQL;
drop table if exists refgene;
create table refgene (
SQL


while(<>)
{
    next unless /CREATE/ .. /^\)/;
    next if /(CREATE|ENGINE|KEY)/;

    s/unsigned//g;
    s/varchar|char|longblob/text/g;
    s/(CREATE|ENGINE|unsigned|KEY|)//g;
    s/enum\([^\)]*\)/text/g;
    s/int/integer/g;
    s/(\w+)\(\d+\)/$1/g;
    s/NOT NULL//g;
    push @sql, $_;
}

for($i=0; $i<=$#sql; $i++)
{
    $sql[$i] =~ s/,\s//g  if $i == $#sql;
    print $sql[$i];
}

print <<SQL;
);
SQL


