Class RowCountTask

Count the row in a table. This task normally uses the COUNT(*) method (could take some time on big tables). You can pass a a filter condition for the count.

Inheritance
System.Object
RowCountTask
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ETLBox.ControlFlow.Tasks
Assembly: ETLBox.dll
Syntax
    public sealed class RowCountTask : ControlFlowTask, ILoggableTask
Examples
int count = RowCountTask.Count("tableName").Value;

Constructors

RowCountTask()

Declaration
    public RowCountTask()

RowCountTask(String)

Declaration
    public RowCountTask(string tableName)
Parameters
TypeNameDescription
System.StringtableName

RowCountTask(String, RowCountOptions)

Declaration
    public RowCountTask(string tableName, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
RowCountOptionsoptions

RowCountTask(String, String)

Declaration
    public RowCountTask(string tableName, string condition)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition

RowCountTask(String, String, RowCountOptions)

Declaration
    public RowCountTask(string tableName, string condition, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition
RowCountOptionsoptions

Properties

Condition

Part of the sql where condition which restrict which rows are counted

Declaration
    public string Condition { get; set; }
Property Value
TypeDescription
System.String

DirtyRead

Will do the row count also on uncommitted reads.

Declaration
    public bool DirtyRead { get; set; }
Property Value
TypeDescription
System.Boolean

HasAnyRows

Indicates if the table contains rows - only has a value after the execution

Declaration
    public bool? HasAnyRows { get; }
Property Value
TypeDescription
System.Nullable<System.Boolean>

QuickQueryMode

For Sql Server, you can set the QuickQueryMode to true. This will query the sys.partition table which can be much faster.

Declaration
    public bool QuickQueryMode { get; set; }
Property Value
TypeDescription
System.Boolean

Rows

Will hold the number of counted rows after execution

Declaration
    public int? Rows { get; }
Property Value
TypeDescription
System.Nullable<System.Int32>

Sql

The sql that is executed to count the rows in the table - will change depending on your parameters.

Declaration
    public string Sql { get; }
Property Value
TypeDescription
System.String

TableName

Name of the table on which the rows are counted

Declaration
    public string TableName { get; set; }
Property Value
TypeDescription
System.String

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

TN

The formatted table table name

Declaration
    public ObjectNameDescriptor TN { get; }
Property Value
TypeDescription
ObjectNameDescriptor

Methods

Count()

Performs the row count

Declaration
    public RowCountTask Count()
Returns
TypeDescription
RowCountTask

Count(IConnectionManager, String)

Declaration
    public static int Count(IConnectionManager connectionManager, string tableName)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
Returns
TypeDescription
System.Int32

Count(IConnectionManager, String, RowCountOptions)

Declaration
    public static int Count(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
RowCountOptionsoptions
Returns
TypeDescription
System.Int32

Count(IConnectionManager, String, String)

Declaration
    public static int Count(IConnectionManager connectionManager, string tableName, string condition)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
System.Stringcondition
Returns
TypeDescription
System.Int32

Count(IConnectionManager, String, String, RowCountOptions)

Declaration
    public static int Count(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
System.Stringcondition
RowCountOptionsoptions
Returns
TypeDescription
System.Int32

Count(String)

Declaration
    public static int Count(string tableName)
Parameters
TypeNameDescription
System.StringtableName
Returns
TypeDescription
System.Int32

Count(String, RowCountOptions)

Declaration
    public static int Count(string tableName, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
RowCountOptionsoptions
Returns
TypeDescription
System.Int32

Count(String, String)

Declaration
    public static int Count(string tableName, string condition)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition
Returns
TypeDescription
System.Int32

Count(String, String, RowCountOptions)

Declaration
    public static int Count(string tableName, string condition, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition
RowCountOptionsoptions
Returns
TypeDescription
System.Int32

HasRows()

Checks if the table has at least one (matching) row.

Declaration
    public RowCountTask HasRows()
Returns
TypeDescription
RowCountTask

HasRows(IConnectionManager, String)

Declaration
    public static bool HasRows(IConnectionManager connectionManager, string tableName)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
Returns
TypeDescription
System.Boolean

HasRows(IConnectionManager, String, RowCountOptions)

Declaration
    public static bool HasRows(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
RowCountOptionsoptions
Returns
TypeDescription
System.Boolean

HasRows(IConnectionManager, String, String)

Declaration
    public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
System.Stringcondition
Returns
TypeDescription
System.Boolean

HasRows(IConnectionManager, String, String, RowCountOptions)

Declaration
    public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
TypeNameDescription
IConnectionManagerconnectionManager
System.StringtableName
System.Stringcondition
RowCountOptionsoptions
Returns
TypeDescription
System.Boolean

HasRows(String)

Declaration
    public static bool HasRows(string tableName)
Parameters
TypeNameDescription
System.StringtableName
Returns
TypeDescription
System.Boolean

HasRows(String, RowCountOptions)

Declaration
    public static bool HasRows(string tableName, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
RowCountOptionsoptions
Returns
TypeDescription
System.Boolean

HasRows(String, String)

Declaration
    public static bool HasRows(string tableName, string condition)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition
Returns
TypeDescription
System.Boolean

HasRows(String, String, RowCountOptions)

Declaration
    public static bool HasRows(string tableName, string condition, RowCountOptions options)
Parameters
TypeNameDescription
System.StringtableName
System.Stringcondition
RowCountOptionsoptions
Returns
TypeDescription
System.Boolean

Implements