Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Client/Server Backup Problem
Tue, Jun 30 2009 12:01 AMPermanent Link

"Adam H."
I'm trying to implement a procedure in an application that calls the server
to backup the database, and then pass the end backup file back to the client
through a parameter.

At this stage I am stuck at a point trying to get the list of files in the
database. I am using the script below but for some reason whenever
TempSession.GetFileNames is called it returns no files.

Just wondering if anyone could comment on where I've gone wrong please?

Cheers

Adam.

procedure TMainForm.ServerEngineServerProcedure(Sender: TObject;
 ServerSession: TDBISAMSession; const ProcedureName: string);
 var
  drive : integer;
  size : int64;
  backupfile : string;
  fileList : TStrings;
  databasename : String;
  tempdatabase : TDBISamDatabase;
  TempDescription : STring;
  TempPath : String;
  TempSession : TDBISamSession;
begin
 if (AnsiCompareText(ProcedureName,'DiskFree')=0) then
   try
   drive :=
ServerSession.RemoteParams.ParamByName('DiskFreeDrive').Asinteger;
   size := diskfree(drive);
   ServerSession.RemoteParams.Clear;
   ServerSession.RemoteParams.CreateParam(ftLargeint, 'DiskFreeSpace');
   ServerSession.RemoteParams.ParamByName('DiskFreeSpace').AsLargeInt :=
size;
  except
  ServerSession.RemoteParams.ParamByName('DiskFreeSpace').AsLargeInt := -1;
  end;

 if (AnsiCompareText(ProcedureName,'GetBackupFile')=0) then
   begin
   backupfile     :=
ServerSession.RemoteParams.ParamByName('backupfilename').asstring;
   ServerSession.RemoteParams.Clear;
   ServerSession.RemoteParams.CreateParam(ftBlob, 'Backupfile');
   ServerSession.RemoteParams.ParamByName('Backupfile').LoadFromFile(backupfile,
ftBlob);
   end;

 if (AnsiCompareText(ProcedureName,'CreateBackupFile')=0) then
   begin
   backupfile     :=
ServerSession.RemoteParams.ParamByName('backupfilename').asstring;
   databasename   :=
ServerSession.RemoteParams.ParamByName('databasename').asstring;
   ServerEngine.GetServerDatabase(databasename, TempDescription, TempPath);
   TempSession := TDBISamSession.create(self);
   TempSession.sessionName := 'BackupSes';
   TempSession.OpenDatabase(Databasename);

   TempDatabase   := TDBISamDatabase.create(self);
   TempDatabase.sessionname  := TempSession.SessionName;
   TempDatabase.databasename := 'BackupDB';
   TempDatabase.Directory    := TempPath;
   TempDatabase.connected    := True;

   filelist := TStringList.create;
   TempSession.GetTableNames(databasename, filelist);  //*********** NO
FILES IN HERE.
   backupfile := 'c:\temp\'+backupfile;
   TempDatabase.Backup(backupfile, 'Database Backup Desc', 7, filelist);

   TempDatabase.close;
   Tempdatabase.free;
   TempSession.close;
   TempSession.free;
   end;
end;
Tue, Jun 30 2009 9:54 AMPermanent Link

"Raul"

Have your tried using the path (rather than name) to the database in the
GetTableNames (TempPath var in your case).

Raul


"Adam H." <ahairsub5@jvxp_removeme.com> wrote in message
news:4A3B1B3C-CDDA-4AE5-AEBA-849A9EF68768@news.elevatesoft.com...
> I'm trying to implement a procedure in an application that calls the
> server to backup the database, and then pass the end backup file back to
> the client through a parameter.
>
> At this stage I am stuck at a point trying to get the list of files in the
> database. I am using the script below but for some reason whenever
> TempSession.GetFileNames is called it returns no files.
>
> Just wondering if anyone could comment on where I've gone wrong please?
>
> Cheers
>
> Adam.
>
> procedure TMainForm.ServerEngineServerProcedure(Sender: TObject;
>  ServerSession: TDBISAMSession; const ProcedureName: string);
>  var
>   drive : integer;
>   size : int64;
>   backupfile : string;
>   fileList : TStrings;
>   databasename : String;
>   tempdatabase : TDBISamDatabase;
>   TempDescription : STring;
>   TempPath : String;
>   TempSession : TDBISamSession;
> begin
>  if (AnsiCompareText(ProcedureName,'DiskFree')=0) then
>    try
>    drive :=
> ServerSession.RemoteParams.ParamByName('DiskFreeDrive').Asinteger;
>    size := diskfree(drive);
>    ServerSession.RemoteParams.Clear;
>    ServerSession.RemoteParams.CreateParam(ftLargeint, 'DiskFreeSpace');
>    ServerSession.RemoteParams.ParamByName('DiskFreeSpace').AsLargeInt :=
> size;
>   except
>   ServerSession.RemoteParams.ParamByName('DiskFreeSpace').AsLargeInt
> := -1;
>   end;
>
>  if (AnsiCompareText(ProcedureName,'GetBackupFile')=0) then
>    begin
>    backupfile     :=
> ServerSession.RemoteParams.ParamByName('backupfilename').asstring;
>    ServerSession.RemoteParams.Clear;
>    ServerSession.RemoteParams.CreateParam(ftBlob, 'Backupfile');
>
> ServerSession.RemoteParams.ParamByName('Backupfile').LoadFromFile(backupfile,
> ftBlob);
>    end;
>
>  if (AnsiCompareText(ProcedureName,'CreateBackupFile')=0) then
>    begin
>    backupfile     :=
> ServerSession.RemoteParams.ParamByName('backupfilename').asstring;
>    databasename   :=
> ServerSession.RemoteParams.ParamByName('databasename').asstring;
>    ServerEngine.GetServerDatabase(databasename, TempDescription,
> TempPath);
>    TempSession := TDBISamSession.create(self);
>    TempSession.sessionName := 'BackupSes';
>    TempSession.OpenDatabase(Databasename);
>
>    TempDatabase   := TDBISamDatabase.create(self);
>    TempDatabase.sessionname  := TempSession.SessionName;
>    TempDatabase.databasename := 'BackupDB';
>    TempDatabase.Directory    := TempPath;
>    TempDatabase.connected    := True;
>
>    filelist := TStringList.create;
>    TempSession.GetTableNames(databasename, filelist);  //*********** NO
> FILES IN HERE.
>    backupfile := 'c:\temp\'+backupfile;
>    TempDatabase.Backup(backupfile, 'Database Backup Desc', 7, filelist);
>
>    TempDatabase.close;
>    Tempdatabase.free;
>    TempSession.close;
>    TempSession.free;
>    end;
> end;
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4199 (20090630) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4199 (20090630) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



Tue, Jun 30 2009 2:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

Raul is correct, use the TempPath variable for the GetTableNames call.
Remember, you're basically running like a local session when executing on
the server.

Also, you can get rid of this line:

   ServerEngine.GetServerDatabase(databasename, TempDescription, TempPath);
   TempSession := TDBISamSession.create(self);
   TempSession.sessionName := 'BackupSes';
   TempSession.OpenDatabase(Databasename);  <<<<<<<<<<<<<<<<<<<  Get rid of

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jul 2 2009 1:39 AMPermanent Link

"Adam H."
Hi Raul,

> Have your tried using the path (rather than name) to the database in the
> GetTableNames (TempPath var in your case).

Thanks for your reply. Works a charm!

Cheers

Adam.
Thu, Jul 2 2009 2:28 AMPermanent Link

"Adam H."
Hi Tim,

> Also, you can get rid of this line:
> <snip>
>    TempSession.OpenDatabase(Databasename);  <<<<<<<<<<<<<<<<<<<  Get rid
> of

Thanks Tim - shall do!

Cheers

Adam.
Image