dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlLoader Class / Delayed Property
Example

In This Topic
    Delayed Property
    In This Topic
    Determines whether to use INSERT DELAYED statement syntax.
    Syntax
    'Declaration
     
    Public Property Delayed As Boolean
    public bool Delayed {get; set;}

    Property Value

    true, if INSERT DELAYED statement syntax is used; otherwise, false. The default value is true.
    Remarks

    Using this option may result in performance increased. However, in this mode the data may be inaccessible right after the Close method invocation. MySQL does not allow to use both Delayed and Lock options at the same time.

    MySQL supports DELAYED keyword only for MyISAM and ISAM storage engines.

    Example
    The following example creates a MySqlLoader, then populates Columns collection from table description, loads data, flushes the buffer and dispose internal MySqlLoader structures. Performance of the script is improved by using delayed insertion.
    public void LoadData(MySqlConnection myConnection)
    {
      myConnection.Open();
      myConnection.Database = "Test";
      MySqlLoader loader = new MySqlLoader();
      loader.Connection = myConnection;
      loader.TableName = "load_table";
      loader.Delayed = true;
      try
      {
        loader.CreateColumns();
        loader.Open();
        for (int i = 1; i <= 10000; i++)
        {
          loader.SetValue("id", i);
          loader.SetValue("char_field", "test string");
          loader.SetValue("date_field", DateTime.Now);
          loader.NextRow();
        }
        loader.Close();
      }
      finally
      {
        myConnection.Close();
      }
    }
    Public Sub LoadData(ByVal myConnection As MySqlConnection)
      myConnection.Open()
      myConnection.Database = "Test"
      Dim loader As MySqlLoader
      loader = New MySqlLoader
      loader.Connection = myConnection
      loader.TableName = "load_table"
      loader.Delayed = True
      Try
        loader.CreateColumns()
        loader.Open()
        Dim i As Integer
        For i = 1 To 10000
          loader.SetValue("id", i)
          loader.SetValue("char_field", "test string")
          loader.SetValue("date_field", DateTime.Now)
          loader.NextRow()
        Next i
        loader.Close()
      Finally
        myConnection.Close()
      End Try
    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