On Sep 15, 2552 BE, at 9:56 PM, Brian Manning wrote:
On Tue, Sep 15, 2009 at 1:51 PM, zhihua zhang
<[email protected]> wrote:
I was trying to load a local data file into a mysql table using DBI,
this is how I did
my $st = "load data local infile \'datafile.dat\' into talbe $table";
my $sth = $dbh->do($st);
it looks good, however, it was not.
in datafile.dat, there are 5053 rows, however there are only 4988
rows loaded
in the table, and the last row in the table was not loaded
correctly, like
Sorry, that's not what you're doing here.
You're calling a MySQL server function (via DBI) that loads the data
from a file located on your server; DBI never sees any of your data
the way you are using it above, only the MySQL server process does.
The only thing that DBI gets out of this call to MySQL is the return
value for the operation from the MySQL server. Maybe you have two
copies of 'datafile.dat', one in a place that you're expecting MySQL
to read it from, and one where it's actually being read from?
Actually I was running the perl script and mySQL server in the same
machine,
so, I'm pretty sure there is just one 'datafile.dat'. The reason I
say there are just 4988
rows in the loaded table was I checked
select count(*) from myTable;
in a MySQL client.
Thanks.
Bill
Thanks,
Brian