Class SqlTask

Executes any sql on the database. Use ExecuteNonQuery for SQL statements returning no data, ExecuteScalar for statements that return only one row and one column or ExecuteReader for SQL that returns multiple rows or columns

Inheritance
System.Object
SqlTask
Implements
Namespace: ETLBox.ControlFlow.Tasks
Assembly: ETLBox.dll
Syntax
    public sealed class SqlTask : DbTask, ILoggableTask
Examples
SqlTask.ExecuteNonQuery("Description","insert into demo.table1 select * from demo.table2");

Constructors

SqlTask()

Declaration
    public SqlTask()

SqlTask(String)

Declaration
    public SqlTask(string sql)
Parameters
TypeNameDescription
System.Stringsql

Sets the Sql

SqlTask(String, Action, Action, Action<Object>[])

Declaration
    public SqlTask(string sql, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]actions

SqlTask(String, Action<Object>[])

Declaration
    public SqlTask(string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Action<System.Object>[]actions

SqlTask(String, IEnumerable<QueryParameter>)

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameter

SqlTask(String, IEnumerable<QueryParameter>, Action, Action, Action<Object>[])

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameter
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]actions

SqlTask(String, IEnumerable<QueryParameter>, Action<Object>[])

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameter
System.Action<System.Object>[]actions

SqlTask(String, String)

Declaration
    public SqlTask(string name, string sql)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql

Properties

TaskName

A name to identify the task or component. Every component or task comes with a default name that can be overwritten.

Declaration
    public override string TaskName { get; set; }
Property Value
TypeDescription
System.String
Overrides

Methods

BulkDelete(IConnectionManager, ITableData)

Declaration
    public static void BulkDelete(IConnectionManager connectionManager, ITableData data)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
ITableDatadata

BulkDelete(String, ITableData)

Declaration
    public static void BulkDelete(string name, ITableData data)
Parameters
TypeNameDescription
System.Stringname
ITableDatadata

BulkInsert(IConnectionManager, ITableData)

Declaration
    public static void BulkInsert(IConnectionManager connectionManager, ITableData data)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
ITableDatadata

BulkInsert(String, ITableData)

Declaration
    public static void BulkInsert(string name, ITableData data)
Parameters
TypeNameDescription
System.Stringname
ITableDatadata

BulkUpdate(IConnectionManager, ITableData, ICollection<String>, ICollection<String>)

Declaration
    public static void BulkUpdate(IConnectionManager connectionManager, ITableData data, ICollection<string> setColumnNames, ICollection<string> joinColumnNames)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
ITableDatadata
System.Collections.Generic.ICollection<System.String>setColumnNames
System.Collections.Generic.ICollection<System.String>joinColumnNames

BulkUpdate(String, ITableData, ICollection<String>, ICollection<String>)

Declaration
    public static void BulkUpdate(string name, ITableData data, ICollection<string> setColumnNames, ICollection<string> joinColumnNames)
Parameters
TypeNameDescription
System.Stringname
ITableDatadata
System.Collections.Generic.ICollection<System.String>setColumnNames
System.Collections.Generic.ICollection<System.String>joinColumnNames

ExecuteNonQuery(IConnectionManager, String)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
Returns
TypeDescription
System.Int32

ExecuteNonQuery(IConnectionManager, String, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Int32

ExecuteNonQuery(IConnectionManager, String, String)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string name, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Int32

ExecuteNonQuery(IConnectionManager, String, String, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string name, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Int32

ExecuteNonQuery(String)

Declaration
    public static int ExecuteNonQuery(string sql)
Parameters
TypeNameDescription
System.Stringsql
Returns
TypeDescription
System.Int32

ExecuteNonQuery(String, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Int32

ExecuteNonQuery(String, String)

Declaration
    public static int ExecuteNonQuery(string name, string sql)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Int32

ExecuteNonQuery(String, String, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(string name, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Int32

ExecuteReader(IConnectionManager, String, Action, Action, Action<Object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string sql, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]actions

ExecuteReader(IConnectionManager, String, Action<Object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReader(IConnectionManager, String, IEnumerable<QueryParameter>, Action<Object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
System.Action<System.Object>[]actions

ExecuteReader(IConnectionManager, String, String, Action<Object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string name, string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReader(String, Action, Action, Action<Object>[])

Declaration
    public static void ExecuteReader(string sql, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]actions

ExecuteReader(String, Action<Object>[])

Declaration
    public static void ExecuteReader(string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReader(String, IEnumerable<QueryParameter>, Action, Action, Action<Object>[])

Declaration
    public static void ExecuteReader(string sql, IEnumerable<QueryParameter> parameterList, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
System.ActionbeforeRowReadAction
System.ActionafterRowReadAction
System.Action<System.Object>[]actions

ExecuteReader(String, IEnumerable<QueryParameter>, Action<Object>[])

Declaration
    public static void ExecuteReader(string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
System.Action<System.Object>[]actions

ExecuteReader(String, String, Action<Object>[])

Declaration
    public static void ExecuteReader(string name, string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReaderSingleLine(IConnectionManager, String, Action<Object>[])

Declaration
    public static void ExecuteReaderSingleLine(IConnectionManager connectionManager, string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReaderSingleLine(IConnectionManager, String, IEnumerable<QueryParameter>, Action<Object>[])

Declaration
    public static void ExecuteReaderSingleLine(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
System.Action<System.Object>[]actions

ExecuteReaderSingleLine(String, Action<Object>[])

Declaration
    public static void ExecuteReaderSingleLine(string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Action<System.Object>[]actions

ExecuteReaderSingleLine(String, IEnumerable<QueryParameter>, Action<Object>[])

Declaration
    public static void ExecuteReaderSingleLine(string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
System.Action<System.Object>[]actions

ExecuteScalar(IConnectionManager, String)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
Returns
TypeDescription
System.Object

ExecuteScalar(IConnectionManager, String, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Object

ExecuteScalar(IConnectionManager, String, String)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string name, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Object

ExecuteScalar(IConnectionManager, String, String, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string name, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Object

ExecuteScalar(String)

Declaration
    public static object ExecuteScalar(string sql)
Parameters
TypeNameDescription
System.Stringsql
Returns
TypeDescription
System.Object

ExecuteScalar(String, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Object

ExecuteScalar(String, String)

Declaration
    public static object ExecuteScalar(string name, string sql)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Object

ExecuteScalar(String, String, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(string name, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Object

ExecuteScalar<T>(IConnectionManager, String)

Declaration
    public static T? ExecuteScalar<T>(IConnectionManager connectionManager, string sql)
    where T : struct
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
Returns
TypeDescription
System.Nullable<T>
Type Parameters
NameDescription
T

ExecuteScalar<T>(IConnectionManager, String, String)

Declaration
    public static T? ExecuteScalar<T>(IConnectionManager connectionManager, string name, string sql)
    where T : struct
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Nullable<T>
Type Parameters
NameDescription
T

ExecuteScalar<T>(String)

Declaration
    public static T? ExecuteScalar<T>(string sql)
    where T : struct
Parameters
TypeNameDescription
System.Stringsql
Returns
TypeDescription
System.Nullable<T>
Type Parameters
NameDescription
T

ExecuteScalar<T>(String, IEnumerable<QueryParameter>)

Declaration
    public static T? ExecuteScalar<T>(string sql, IEnumerable<QueryParameter> parameterList)
    where T : struct
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Nullable<T>
Type Parameters
NameDescription
T

ExecuteScalar<T>(String, String)

Declaration
    public static T? ExecuteScalar<T>(string name, string sql)
    where T : struct
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Nullable<T>
Type Parameters
NameDescription
T

ExecuteScalarAsBool(IConnectionManager, String)

Declaration
    public static bool ExecuteScalarAsBool(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringsql
Returns
TypeDescription
System.Boolean

ExecuteScalarAsBool(IConnectionManager, String, String)

Declaration
    public static bool ExecuteScalarAsBool(IConnectionManager connectionManager, string name, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Boolean

ExecuteScalarAsBool(String)

Declaration
    public static bool ExecuteScalarAsBool(string sql)
Parameters
TypeNameDescription
System.Stringsql
Returns
TypeDescription
System.Boolean

ExecuteScalarAsBool(String, IEnumerable<QueryParameter>)

Declaration
    public static bool ExecuteScalarAsBool(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
System.Stringsql
System.Collections.Generic.IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
System.Boolean

ExecuteScalarAsBool(String, String)

Declaration
    public static bool ExecuteScalarAsBool(string name, string sql)
Parameters
TypeNameDescription
System.Stringname
System.Stringsql
Returns
TypeDescription
System.Boolean

Implements