Connecting Tech Pros Worldwide Help | Site Map

bulk load questions

picaza
Guest
 
Posts: n/a
#1: Jul 20 '05

hi,

i am using the perl DBI.

-- how can i make load_file read a blob. it treats the file contents as
a string rather than text/blob.

-- is there an ENV or mysql var to tell the engine where to find files
you want to load? mysql looks in ~ by default and i know i can use a
full path but it is reather long and cumbersome.

tia,
peter

Bill Karwin
Guest
 
Posts: n/a
#2: Jul 20 '05

re: bulk load questions


picaza wrote:
[color=blue]
> i am using the perl DBI.
> -- how can i make load_file read a blob. it treats the file contents as
> a string rather than text/blob.[/color]

LOAD DATA doesn't support blobs.

I have used DBI to insert blobs by using parameters in an INSERT statement.
1. prepare INSERT INTO myTable (blobField) VALUES(?)
2. do whatever I need to load the contents of a file into a Perl scalar.
3. execute the prepared statement with the Perl scalar as a parameter.
[color=blue]
> -- is there an ENV or mysql var to tell the engine where to find files
> you want to load? mysql looks in ~ by default and i know i can use a
> full path but it is reather long and cumbersome.[/color]

Relative paths are relative to the MySQL data directory, according to
the documentation (http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html).
There doesn't seem to be an option for an alternate home.

Regards,
Bill K.
Closed Thread