You know, of course, that the LOAD_FILE function only works if the file is
in the server's host.
If the file is not in the same host, then you should read the file with your script and insert all the values with a query.
# 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);
}
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.
_ _ _ _
(_|| | |(_|><
_|
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.