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
object
RowCountTask
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
public sealed class RowCountTask : ControlFlowTask, ILoggableTask
Examples
int count = RowCountTask.Count("tableName").Value;
Constructors
RowCountTask()
Declaration
Examples
int count = RowCountTask.Count("tableName").Value;
RowCountTask(string, RowCountOptions)
Declaration
public RowCountTask(string tableName, RowCountOptions options)
Parameters
Examples
int count = RowCountTask.Count("tableName").Value;
RowCountTask(string, string, RowCountOptions)
Declaration
public RowCountTask(string tableName, string condition, RowCountOptions options)
Parameters
Examples
int count = RowCountTask.Count("tableName").Value;
RowCountTask(string, string)
Declaration
public RowCountTask(string tableName, string condition)
Parameters
Type | Name | Description |
---|
string | tableName | |
string | condition | |
Examples
int count = RowCountTask.Count("tableName").Value;
RowCountTask(string)
Declaration
public RowCountTask(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
Examples
int count = RowCountTask.Count("tableName").Value;
Properties
Condition
Part of the sql where condition which restrict which rows are counted
Declaration
public string Condition { get; set; }
Property Value
DirtyRead
Will do the row count also on uncommitted reads.
Declaration
public bool DirtyRead { get; }
Property Value
Options
For Sql Server, you can set the QuickQueryMode to true. This will query the sys.partition table which can be much faster.
If set to DirtyRead, the count will also read uncommitted rows.
If set ReadOnlyFirstRow, the count will use a limit when running
Declaration
public RowCountOptions Options { get; set; }
Property Value
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; }
Property Value
Rows
Will hold the number of counted rows after execution
Declaration
public int? Rows { get; }
Property Value
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
TableName
Name of the table on which the rows are counted
Declaration
public string TableName { get; set; }
Property Value
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
Overrides
TN
The formatted table table name
Declaration
public ObjectNameDescriptor TN { get; }
Property Value
Methods
Count()
Declaration
Returns
Count(IConnectionManager, string, RowCountOptions)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(IConnectionManager, string, string, RowCountOptions)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(IConnectionManager, string, string)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(IConnectionManager, string)
Declaration
public static int Count(IConnectionManager connectionManager, string tableName)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(string, RowCountOptions)
Declaration
public static int Count(string tableName, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(string, string, RowCountOptions)
Declaration
public static int Count(string tableName, string condition, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(string, string)
Declaration
public static int Count(string tableName, string condition)
Parameters
Type | Name | Description |
---|
string | tableName | |
string | condition | |
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Count(string)
Declaration
public static int Count(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
CountAsync()
Declaration
public Task<int> CountAsync()
Returns
Type | Description |
---|
System.Threading.Tasks.Task<TResult><int> | |
CountAsync(IConnectionManager, string, RowCountOptions)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
Type | Description |
---|
System.Threading.Tasks.Task<TResult><int> | |
Examples
int count = RowCountTask.Count("tableName").Value;
CountAsync(IConnectionManager, string, string, RowCountOptions)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
Type | Description |
---|
System.Threading.Tasks.Task<TResult><int> | |
Examples
int count = RowCountTask.Count("tableName").Value;
CountAsync(IConnectionManager, string, string)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
Type | Description |
---|
System.Threading.Tasks.Task<TResult><int> | |
Examples
int count = RowCountTask.Count("tableName").Value;
CountAsync(IConnectionManager, string)
Declaration
public static Task<int> CountAsync(IConnectionManager connectionManager, string tableName)
Parameters
Returns
Type | Description |
---|
System.Threading.Tasks.Task<TResult><int> | |
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows()
Checks if the table has at least one (matching) row.
Declaration
Returns
HasRows(IConnectionManager, string, RowCountOptions)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(IConnectionManager, string, string, RowCountOptions)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(IConnectionManager, string, string)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName, string condition)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(IConnectionManager, string)
Declaration
public static bool HasRows(IConnectionManager connectionManager, string tableName)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(string, RowCountOptions)
Declaration
public static bool HasRows(string tableName, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(string, string, RowCountOptions)
Declaration
public static bool HasRows(string tableName, string condition, RowCountOptions options)
Parameters
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(string, string)
Declaration
public static bool HasRows(string tableName, string condition)
Parameters
Type | Name | Description |
---|
string | tableName | |
string | condition | |
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
HasRows(string)
Declaration
public static bool HasRows(string tableName)
Parameters
Type | Name | Description |
---|
string | tableName | |
Returns
Examples
int count = RowCountTask.Count("tableName").Value;
Implements