hello,i'm now intending to insert some data into mysql using perl
dbi,i first write the code under ubuntu OS and it run perfect(use
aboat 1 second),but when i do the samethings under windows OS,it's
becoming very slow(use aboat 1.5 minute), i wonder what cause this
difference?is there anyway to solve it?
here is my code:
use strict;
use DBI;
my @filename=glob"*.gff";
my ($year,$month,$day)=(localtime)[5,4,3];
my $TableName="test";
my $dbh=DBI->connect("dbi:mysql:annotation","root","123456")||die
"$DBI::errstr";
$dbh->do("DROP TABLE IF EXISTS $TableName");
my $CreateTable=qq{
CREATE TABLE $TableName(
`SampleName` char(32) NOT NULL default '',
`PeakID` varchar(16) NOT NULL default '',
`PeakChromosome` varchar(16) NOT NULL default '',
`PeakStart` int(16),
`PeakEnd` int(16),
`PeakLength` int(16),
`PeakScore` float(5,2)
)};
$dbh->do($CreateTable);
my $ImportData=$dbh->prepare("INSERT INTO $TableName
(SampleName,PeakID,PeakChromosome,PeakStart,PeakEnd,PeakLength,PeakScore)
VALUES (?,?,?,?,?,?,?)");
my $PeakID=0;
foreach my $filename(@filename){
print "importing $filename\n";
$filename=~/(.*)(_635_ratio_peaks.gff|_532_ratio_peaks.gff)/;
open(IN,"<$filename");
while(<IN>){
$PeakID++;
chomp;
my @temp=split(/\t/);
$ImportData->execute($1,$PeakID,$temp[0],$temp[3],$temp
[4],$temp[4]-$temp[3],$temp[5]);
}
}