How to stop Backup in progress with MyDAC library

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
baccochr
Posts: 2
Joined: Sat 24 Feb 2007 13:16

How to stop Backup in progress with MyDAC library

Post by baccochr » Sat 24 Feb 2007 13:26

Hello

I'm using the MyDump->BackupToFile command in my app.

For some reasons, I would like to be able to stop the backup when it has been started.

I could see that the BackupToFile command was not a blocking call. So I have added a button allowing to press cancel to stop it.

But then, I don't know how to do : I didn't find any method or property allowing to stop it !

I've tried to free the connection with 'MyDump->Connection = NULL' but it doesn't work.

Any idea ???

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 26 Feb 2007 11:51

The BackupToFile method of TMyDump is a synchronous method. To be able to interrupt saving data with the BackupToFile method, you should implement a multithreaded application and execute backing up to file in another thread through a separate connection. To stop saving data, you should execute the KILL command for the connection used in the additional thread.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 27 Feb 2007 13:12

Another way that looks simpler, is to add a handler to the OnBackupProgress event. When you need to interrupt the backing up operation, just call the Abort procedure.

baccochr
Posts: 2
Joined: Sat 24 Feb 2007 13:16

Post by baccochr » Mon 05 Mar 2007 10:51

Thanks you for your ideas
The second method works perfectly

Post Reply