dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlDump Class / Progress Event
Example

In This Topic
    Progress Event (MySqlDump)
    In This Topic
    Occurs when MySqlDump processes next database object or SQL statement.
    Syntax
    'Declaration
     
    Public Event Progress As MySqlDumpProgressEventHandler
    public event MySqlDumpProgressEventHandler Progress
    Event Data

    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.

    PropertyDescription
    Gets quantity of rows in table that is being dumped or total quantity of statements in a script.  
    Gets how many objects MySqlDump has to backup.  
    Gets name of current object being dumped.  
    Gets number of current object being dumped.  
    Gets type of current object being dumped.  
    Gets quantity of dumped rows in current table or number of current statement in a script.  
    Remarks

    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.

    Example
    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
    Requirements

    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

    See Also