1

First,Greetings from Beijing before the Spring Festival --"过年好!".

I have a perl script to load data file into the database.The script runs good,but the returned information is always not correct.

Problem:

the code is like this :

     $sql_load="LOAD DATA LOCAL INFILE $FileName REPLACE INTO TABLE ".$TableName ;
     $sth=$dbi->do($sql_load) ;#or die "SQL Error: $DBI::errstr\n";
     if(DBI->err){
         print "      after connect, SQL Error:$DBI::errstr\n";
     }else{
         print "      $sth . Records Uploaded \n";
     }

the output is like this:

     7 . Records Uploaded.

But Actually:

the wc -l $FileName is 6 (including the first line which is the field names line), the count of data line is 5.

the returned count number is always equal the correct number plus 2.

Question:
I have googled for this question many times but with no luck,and didn't get useful info from the mysql docs too. How can I get the right count number?What does the plus 2 number mean?

4

1 回答 1

0
于 2013-02-06T10:27:44.097 回答