in reply to load_file and mysql
This example will only work if the size of your file is less than max_allowed_packet. I have a similar routine in my database and I have had no problems inserting big fields. The maximum allowed is 16 MB, but I never needed anything more than 3 MB.# untested my $query = qq{ INSERT INTO search VALUES (? ?)}; my $sth = $dbh->prepare($query); # get the list of filenames into an array, or just loop # though them as you wish. This is just an example for my $filename (@files) { local $/ = undef; # will read the file at once open FILE, "< $filename"; my $text = <FILE>; close FILE; $sth->execute( $filename, $text); }
_ _ _ _ (_|| | |(_|>< _|
|
|---|