Re: [phpodpworld-users] Phpodpworld.pl temp file not found
Status: Beta
Brought to you by:
hansfn
|
From: Howard L. <hl...@gm...> - 2007-07-05 05:52:17
|
On 7/4/07, Nicholas Johnston <joh...@ne...> wrote:
> Hello all,
>
> Using phpodpworld.pl to import structure or content in the database, all
> records are successfully loaded, but then followed by the error below:
>
> DBD::mysql::db do failed: File 'C:WINDOWSTEMP1NfxkiP8CnW' not found
> (Errcode: 2) at C:\\mypath\phpodpworld.pl line 576.
>
> The temp file is created successfully in the correct directory, but then
> cannot be found successfully. I can only think that the path shown,
> C:WINDOWSTEMP1NfxkiP8CnW, is not successful because it doesn't contain the
> slashes required...
I use it on Linux and MySQL and this problem does not occur.
Apparently MySQL requires double backslashes for paths in LOAD DATA
statement on Windows.
For testing purpose, I would suggest to change the below statements
and see if it works or not. There might be a better way to do it
though.
From:
$dbh->do("LOAD DATA LOCAL INFILE '$tempname' INTO TABLE xurls FIELDS
OPTIONALLY ENCLOSED BY \"'\"");
To:
my $tempname_mysql = $tempname;
$tempname_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$tempname_mysql' INTO TABLE xurls
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
From:
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res' INTO TABLE resources
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
$dbh->do("LOAD DATA LOCAL INFILE '$temp_str' INTO TABLE structure
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
To:
my $temp_res_mysql = $temp_res;
my $temp_str_mysql = $temp_str;
$temp_res_mysql =~ s/\\/\\\\/g;
$temp_str_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res_mysql' INTO TABLE
resources FIELDS OPTIONALLY ENCLOSED BY \"'\"");
$dbh->do("LOAD DATA LOCAL INFILE '$temp_str_mysql' INTO TABLE
structure FIELDS OPTIONALLY ENCLOSED BY \"'\"");
Howard
|