Subject | UDF for checking if an external file exists |
---|---|
Author | Helmut Steinberger |
Post date | 2008-04-15T16:37:37Z |
Hello,
I need an UDF that checks if an external file exists (in fact I need
an udf getting data from that file and return it as blob, but to make
it more easy i reduce the problem to the basic).
I allready found a way to do so, but unfortunately it doesn't work
with mapped directories or UNC pathnames.
It only works with the local pathname.
This is an example udf:
function check_filename (fn: PChar): integer; cdecl; export;
begin
if fileexists (sz) then
result := 1
else
result := 0;
end;
if I call
select check_filename ('c:\myfile') from rdb$database
it works.
select check_filename ('\\server\server_c\myfile') from rdb$database
does not work.
select check_filename ('f:\myfile') from rdb$database
where f: is mapped to c:\ on server, does not work.
How could I get fileexist working on a network path?
As I told above, I need to get data from the external file to return
it as blob. This is not the problem. This allready works with local
pathnames, so I only habe to solve the fileexists (and finally the
loadfromfile) problem with remote pathnames.
Kind regards
Helmut
I need an UDF that checks if an external file exists (in fact I need
an udf getting data from that file and return it as blob, but to make
it more easy i reduce the problem to the basic).
I allready found a way to do so, but unfortunately it doesn't work
with mapped directories or UNC pathnames.
It only works with the local pathname.
This is an example udf:
function check_filename (fn: PChar): integer; cdecl; export;
begin
if fileexists (sz) then
result := 1
else
result := 0;
end;
if I call
select check_filename ('c:\myfile') from rdb$database
it works.
select check_filename ('\\server\server_c\myfile') from rdb$database
does not work.
select check_filename ('f:\myfile') from rdb$database
where f: is mapped to c:\ on server, does not work.
How could I get fileexist working on a network path?
As I told above, I need to get data from the external file to return
it as blob. This is not the problem. This allready works with local
pathnames, so I only habe to solve the fileexists (and finally the
loadfromfile) problem with remote pathnames.
Kind regards
Helmut