in reply to load_file and mysql

I havent had any experience with MySQL specifically using DBI, however in my oracle and postgres travels i always set raiseerror=>1 and check the errstr after the statement.

This doesnt directly help you, but there may be something there you're not seeing.

I also recommend the use of placeholders in your statements as the db engine doesnt have to parse the entire statement each time, rather just pull it out of its cache, just saves a bit of overhead. In fact its so easy to use, i dont know why people dont. (Unless their db engine doesnt support if of course.. )

Replies are listed 'Best First'.
Re: Re: load_file and mysql
by mce (Curate) on Feb 07, 2002 at 10:36 UTC
    Hi Ryszard,
    I changed (on popular demand :-) ) the code to:
    foreach ( readdir DIR ) { next if /^\.{1,2}$/; my $file=$dir."/".$_; my $query; my $h; $file=$o->quote($file); $query='insert into search ( title ) values ( ? )'; $h=$o->prepare($query); print "$query: ",$h->execute($file),"\n"; print $h->errstr() if $h->err(); $query='update search set body=LOAD_FILE(?) where title = ? ' ; $h=$o->prepare($query); print "$query: ",$h->execute($file),"\n"; print $h->errstr() if $h->err(); } closedir(DIR);
    and the problem remains.
    ps: If I remove LOAD_FILE and just insert ? (placeholder), it works fine. I guess DBI has a problem with the LOAD_FILE part.
    ---------------------------
    Dr. Mark Ceulemans
    Senior Consultant
    IT Masters, Belgium