MySQL Forums
Forum List  »  Perl

**I'm Confused** Screen Output of LOAD DATA LOCAL INFILE
Posted by: dilcher
Date: September 07, 2007 09:37AM

Hello!

I am using the below method for uploading a text file into my database using DBI in perl. When I run this statement manually, logging into mysql, it doesn't produce much screen output.

(what it does output, about numbers of lines updated, etc., is great- I wish I could capture it in my perl application, but don't know how.)

However, when I run it via the perl snippet, below, it echos all the records of the database to the screen as it is presumably uploading/updating the mysql database. The upload succeeds, but I can't figure out why I get all the record info echoing to my screen.

All I really need is less screen output, but, it would be nice if I could capture the "xxx lines updated" type output only, like manually using mysql to issue the command would do.

Can anyone help me out with a clue here?




use DBI();
my $dbh = DBI->connect("DBI:mysql:database=mydatabase;host=my.host.com:3306", "myusername", "mypassword")
or die "$DBI::errstr";

my $sql_load = "LOAD DATA LOCAL INFILE \"/home/user/file.txt\" INTO TABLE Membership FIELDS TERMINATED BY \'||\'";

$dbh->do($sql_load) or die "$DBI::errstr";



Edited 3 time(s). Last edit at 09/07/2007 10:32AM by dilcher.

Options: ReplyQuote


Subject
Written By
Posted
**I'm Confused** Screen Output of LOAD DATA LOCAL INFILE
September 07, 2007 09:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.