SqlTask

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

Implements
Namespace: ETLBox.ControlFlow
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
stringsql

Sets the Sql

SqlTask(string, Action, Action, params Action<object>[])

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

SqlTask(string, params Action<object>[])

Declaration
    public SqlTask(string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
stringsql
Action<object>[]actions

SqlTask(string, IEnumerable<QueryParameter>)

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameter

SqlTask(string, IEnumerable<QueryParameter>, Action, Action, params Action<object>[])

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameter
ActionbeforeRowReadAction
ActionafterRowReadAction
Action<object>[]actions

SqlTask(string, IEnumerable<QueryParameter>, params Action<object>[])

Declaration
    public SqlTask(string sql, IEnumerable<QueryParameter> parameter, params Action<object>[] actions)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameter
Action<object>[]actions

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
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
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
ICollection<string>setColumnNames
ICollection<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
stringname
ITableDatadata
ICollection<string>setColumnNames
ICollection<string>joinColumnNames

ExecuteNonQuery(IConnectionManager, string)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
int

ExecuteNonQuery(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
int

ExecuteNonQuery(string)

Declaration
    public static int ExecuteNonQuery(string sql)
Parameters
TypeNameDescription
stringsql
Returns
TypeDescription
int

ExecuteNonQuery(string, IEnumerable<QueryParameter>)

Declaration
    public static int ExecuteNonQuery(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
int

ExecuteNonQueryAsync(IConnectionManager, string)

Declaration
    public static Task<int> ExecuteNonQueryAsync(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
Task<int>

ExecuteNonQueryAsync(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static Task<int> ExecuteNonQueryAsync(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
Task<int>

ExecuteReader(IConnectionManager, string, Action, Action, params Action<object>[])

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

ExecuteReader(IConnectionManager, string, params Action<object>[])

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

ExecuteReader(IConnectionManager, string, IEnumerable<QueryParameter>, Action, Action, params Action<object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
ActionbeforeRowReadAction
ActionafterRowReadAction
Action<object>[]actions

ExecuteReader(IConnectionManager, string, IEnumerable<QueryParameter>, params Action<object>[])

Declaration
    public static void ExecuteReader(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Action<object>[]actions

ExecuteReader(string, Action, Action, params Action<object>[])

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

ExecuteReader(string, params Action<object>[])

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

ExecuteReader(string, IEnumerable<QueryParameter>, Action, Action, params Action<object>[])

Declaration
    public static void ExecuteReader(string sql, IEnumerable<QueryParameter> parameterList, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameterList
ActionbeforeRowReadAction
ActionafterRowReadAction
Action<object>[]actions

ExecuteReader(string, IEnumerable<QueryParameter>, params Action<object>[])

Declaration
    public static void ExecuteReader(string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameterList
Action<object>[]actions

ExecuteReaderAsync(IConnectionManager, string, Action, Action, params Action<object>[])

Declaration
    public static Task ExecuteReaderAsync(IConnectionManager connectionManager, string sql, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
ActionbeforeRowReadAction
ActionafterRowReadAction
Action<object>[]actions
Returns
TypeDescription
Task

ExecuteReaderAsync(IConnectionManager, string, params Action<object>[])

Declaration
    public static Task ExecuteReaderAsync(IConnectionManager connectionManager, string sql, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Action<object>[]actions
Returns
TypeDescription
Task

ExecuteReaderAsync(IConnectionManager, string, IEnumerable<QueryParameter>, Action, Action, params Action<object>[])

Declaration
    public static Task ExecuteReaderAsync(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, Action beforeRowReadAction, Action afterRowReadAction, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
ActionbeforeRowReadAction
ActionafterRowReadAction
Action<object>[]actions
Returns
TypeDescription
Task

ExecuteReaderAsync(IConnectionManager, string, IEnumerable<QueryParameter>, params Action<object>[])

Declaration
    public static Task ExecuteReaderAsync(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList, params Action<object>[] actions)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Action<object>[]actions
Returns
TypeDescription
Task

ExecuteScalar(IConnectionManager, string)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
object

ExecuteScalar(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
object

ExecuteScalar(string)

Declaration
    public static object ExecuteScalar(string sql)
Parameters
TypeNameDescription
stringsql
Returns
TypeDescription
object

ExecuteScalar(string, IEnumerable<QueryParameter>)

Declaration
    public static object ExecuteScalar(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
object

ExecuteScalarAsync(IConnectionManager, string)

Declaration
    public static Task<object> ExecuteScalarAsync(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
Task<object>

ExecuteScalarAsync(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static Task<object> ExecuteScalarAsync(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
Task<object>

ExecuteScalarAsync<T>(IConnectionManager, string)

Declaration
    public static Task<T> ExecuteScalarAsync<T>(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
Task<T>
Type Parameters
NameDescription
T

ExecuteScalarAsync<T>(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static Task<T> ExecuteScalarAsync<T>(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
Task<T>
Type Parameters
NameDescription
T

ExecuteScalar<T>(IConnectionManager, string)

Declaration
    public static T ExecuteScalar<T>(IConnectionManager connectionManager, string sql)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
Returns
TypeDescription
T
Type Parameters
NameDescription
T

ExecuteScalar<T>(IConnectionManager, string, IEnumerable<QueryParameter>)

Declaration
    public static T ExecuteScalar<T>(IConnectionManager connectionManager, string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
T
Type Parameters
NameDescription
T

ExecuteScalar<T>(string)

Declaration
    public static T ExecuteScalar<T>(string sql)
Parameters
TypeNameDescription
stringsql
Returns
TypeDescription
T
Type Parameters
NameDescription
T

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

Declaration
    public static T ExecuteScalar<T>(string sql, IEnumerable<QueryParameter> parameterList)
Parameters
TypeNameDescription
stringsql
IEnumerable<QueryParameter>parameterList
Returns
TypeDescription
T
Type Parameters
NameDescription
T

Implements