'Declaration Public Event Progress As MySqlDumpProgressEventHandler
public event MySqlDumpProgressEventHandler Progress
The event handler receives an argument of type MySqlDumpProgressEventArgs containing data related to this event. The following MySqlDumpProgressEventArgs properties provide information specific to this event.
Property | Description |
---|---|
MaxProgress | Gets quantity of rows in table that is being dumped or total quantity of statements in a script. |
ObjectCount | Gets how many objects MySqlDump has to backup. |
ObjectName | Gets name of current object being dumped. |
ObjectNumber | Gets number of current object being dumped. |
ObjectType | Gets type of current object being dumped. |
Progress | Gets quantity of dumped rows in current table or number of current statement in a script. |
This event can be generated by two methods: Backup and Restore.
When Backup method is in progress, members of MySqlDumpProgressEventArgs provide the following information: name and type of object being dumped, how many objects there are total and which is current, how many rows a table has and how many are dumped already.
When Restore method is in progress, only two properties of MySqlDumpProgressEventArgs have meaning. MaxProgress shows how many statements the script consists of. Progress indicates what statement is current. The other properties of MySqlDumpProgressEventArgs object are not used when restoring data from a dump script.
If you want to stop script execution from the event handler, you can raise an exception. In case of Restore method it will be handled by Error event handler.
private static void myDump_Progress(object sender, MySqlDumpProgressEventArgs e) { Console.WriteLine(e.ObjectName + " " + e.ObjectType); } static void Main(string[] args) { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = "User Id=root;Password=root;Host=localhost;Port=3306;Database=Test;"; myConnection.Open(); MySqlDump myDump = new MySqlDump(); myDump.Connection = myConnection; myDump.ExportAll = true; myDump.Progress += new Devart.Data.MySql.MySqlDumpProgressEventHandler(myDump_Progress); try { myDump.Backup("d:\\tmp\\mydump.dmp"); } finally { myConnection.Close(); } }
Private Shared Sub myDump_Progress(ByVal sender As Object, ByVal e As MySqlDumpProgressEventArgs) Console.WriteLine((e.ObjectName & " " & e.ObjectType)) End Sub Private Shared Sub Main(ByVal args As String()) Dim myConnection As New MySqlConnection myConnection.ConnectionString = "User Id=root;Password=root;Host=localhost;Port=3306;Database=Test;" myConnection.Open() Dim myDump As New MySqlDump myDump.Connection = myConnection myDump.ExportAll = True AddHandler myDump.Progress, AddressOf myDump_Progress Try myDump.Backup("d:\\tmp\\mydump.dmp" Finally myConnection.Close() End Try RemoveHandler myDump.Error, AddressOf myDump_Progress End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2