Subject | Copy database before backup |
---|---|
Author | Robert F. Tulloch |
Post date | 2002-02-18T16:16:04Z |
Hi:
Questions-
When I execute below from a TIBSQL (or IBConsole), I get error that
connection lost. I put in some ShowMessage() to see if FileExist was
returning True. That is not the problem.
The result set (IBConsole) is a whole bunch of "Result", the first
being 0 and the rest null. I have other udf and procedure structured
similar and
exactly in the same manner and they function fine except none of them
"copy"
anything.
When executed from within the app, it does copy but pops up several
errors:
Win32 error 10058-Server Disabled. and or
1053L ERROR_SERVICE_REQUEST_TIMEOUT The service did not
respond to the start or control request in a timely fashion.
Any insight appreciated.
Procedure and udf for copying gdb before backup:
-------------------------------------------------------------
set term ## ;
create procedure CopyDatabase(SourcePath VARCHAR(80), DestinationPath
VARCHAR(80))
Returns(Result Integer))
as
begin
Result = CopyIBDatabase(SourcePath, DestinationPath);
suspend;
exit;
end ##
set term ; ##
--------------------------------------------------------------
/* External Function declarations */
DECLARE EXTERNAL FUNCTION COPYIBDATABASE
CSTRING(80) CHARACTER SET NONE, CSTRING(80) CHARACTER SET NONE
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fn_CopyIbDatabase' MODULE_NAME 'ltudf';
--------------------------------------------------------------
extern "C" __declspec(dllexport) int __stdcall
fn_CopyIbDatabase(String SourcePath, String DestinationPath);
//--------------------------------------------------------------------
int __stdcall fn_CopyIbDatabase(String SourcePath, String
DestinationPath)
{
int Result;
try
{
if (FileExists(SourcePath))
Result = CopyFileA(SourcePath.c_str(),
DestinationPath.c_str(), false);
else
Result = 0;
}
catch(...)
{
Result = 0;
}
return Result;
}
-------------------------------------------------------------------------
Test call from IBConsole
select * from CopyDatabase('F:\LTDMS\LTDMSA\Data\LTDMSData.gdb',
'F:\LTDMS\LTDMSA\Data\DataCopy\LTDMSData.gdb')
--------------------------------------------------------------------------
Questions-
When I execute below from a TIBSQL (or IBConsole), I get error that
connection lost. I put in some ShowMessage() to see if FileExist was
returning True. That is not the problem.
The result set (IBConsole) is a whole bunch of "Result", the first
being 0 and the rest null. I have other udf and procedure structured
similar and
exactly in the same manner and they function fine except none of them
"copy"
anything.
When executed from within the app, it does copy but pops up several
errors:
Win32 error 10058-Server Disabled. and or
1053L ERROR_SERVICE_REQUEST_TIMEOUT The service did not
respond to the start or control request in a timely fashion.
Any insight appreciated.
Procedure and udf for copying gdb before backup:
-------------------------------------------------------------
set term ## ;
create procedure CopyDatabase(SourcePath VARCHAR(80), DestinationPath
VARCHAR(80))
Returns(Result Integer))
as
begin
Result = CopyIBDatabase(SourcePath, DestinationPath);
suspend;
exit;
end ##
set term ; ##
--------------------------------------------------------------
/* External Function declarations */
DECLARE EXTERNAL FUNCTION COPYIBDATABASE
CSTRING(80) CHARACTER SET NONE, CSTRING(80) CHARACTER SET NONE
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fn_CopyIbDatabase' MODULE_NAME 'ltudf';
--------------------------------------------------------------
extern "C" __declspec(dllexport) int __stdcall
fn_CopyIbDatabase(String SourcePath, String DestinationPath);
//--------------------------------------------------------------------
int __stdcall fn_CopyIbDatabase(String SourcePath, String
DestinationPath)
{
int Result;
try
{
if (FileExists(SourcePath))
Result = CopyFileA(SourcePath.c_str(),
DestinationPath.c_str(), false);
else
Result = 0;
}
catch(...)
{
Result = 0;
}
return Result;
}
-------------------------------------------------------------------------
Test call from IBConsole
select * from CopyDatabase('F:\LTDMS\LTDMSA\Data\LTDMSData.gdb',
'F:\LTDMS\LTDMSA\Data\DataCopy\LTDMSData.gdb')
--------------------------------------------------------------------------