Search Results for

    Show / Hide Table of Contents

    Class MySqlScript

    Provides a class capable of executing a SQL script containing multiple SQL statements including CREATE PROCEDURE statements that require changing the delimiter

    Inheritance
    System.Object
    MySqlScript
    Namespace: MySql.Data.MySqlClient
    Assembly: MySql.Data.dll
    Version: 9.3.0
    Syntax
    public class MySqlScript

    Constructors

    MySqlScript()

    Initializes a new instance of the MySqlScript class.

    Declaration
    public MySqlScript()

    MySqlScript(MySqlConnection)

    Initializes a new instance of the MySqlScript class.

    Declaration
    public MySqlScript(MySqlConnection connection)
    Parameters
    Type Name Description
    MySqlConnection connection

    The connection.

    MySqlScript(MySqlConnection, String)

    Initializes a new instance of the MySqlScript class.

    Declaration
    public MySqlScript(MySqlConnection connection, string query)
    Parameters
    Type Name Description
    MySqlConnection connection

    The connection.

    System.String query

    The query.

    MySqlScript(String)

    Initializes a new instance of the MySqlScript class.

    Declaration
    public MySqlScript(string query)
    Parameters
    Type Name Description
    System.String query

    The query.

    Properties

    Connection

    Gets or sets the connection.

    Declaration
    public MySqlConnection Connection { get; set; }
    Property Value
    Type Description
    MySqlConnection

    The connection.

    Delimiter

    Gets or sets the delimiter.

    Declaration
    public string Delimiter { get; set; }
    Property Value
    Type Description
    System.String

    The delimiter.

    Query

    Gets or sets the query.

    Declaration
    public string Query { get; set; }
    Property Value
    Type Description
    System.String

    The query.

    Methods

    Execute()

    Executes this instance.

    Declaration
    public int Execute()
    Returns
    Type Description
    System.Int32

    The number of statements executed as part of the script.

    ExecuteAsync()

    Initiates the asynchronous execution of SQL statements.

    Declaration
    public Task<int> ExecuteAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Int32>

    The number of statements executed as part of the script inside.

    ExecuteAsync(CancellationToken)

    Initiates the asynchronous execution of SQL statements.

    Declaration
    public Task<int> ExecuteAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    System.Threading.CancellationToken cancellationToken

    The cancellation token.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Int32>

    The number of statements executed as part of the script inside.

    Events

    Error

    Handles the event raised whenever an error is raised by the execution of a script.

    Declaration
    public event MySqlScriptErrorEventHandler Error
    Event Type
    Type Description
    MySqlScriptErrorEventHandler

    ScriptCompleted

    Handles the event raised whenever a script execution is finished.

    Declaration
    public event EventHandler ScriptCompleted
    Event Type
    Type Description
    System.EventHandler

    StatementExecuted

    Handles the event raised whenever a statement is executed.

    Declaration
    public event MySqlStatementExecutedEventHandler StatementExecuted
    Event Type
    Type Description
    MySqlStatementExecutedEventHandler
    In This Article
    Back to top Copyright © 2021, 2025, Oracle and/or its affiliates.