Class TableData

Defines a list of rows that can be inserted into a table

Inheritance
TableData
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
    public class TableData : ITableData, IDataReader, IDataRecord, IDisposable

Constructors

TableData(TableDefinition)

Declaration
    public TableData(TableDefinition definition)
Parameters
TypeNameDescription
TableDefinitiondefinition

TableData(TableDefinition, int)

Declaration
    public TableData(TableDefinition definition, int estimatedBatchSize)
Parameters
TypeNameDescription
TableDefinitiondefinition
intestimatedBatchSize

Properties

AllowIdentityInsert

If set to true, the connection manager will try to enable identity inserts for the corresponding table (not supported by every database)

Declaration
    public bool AllowIdentityInsert { get; set; }
Property Value
TypeDescription
bool

ColumnConverters

Declaration
    public Dictionary<string, Func<object, object>> ColumnConverters { get; set; }
Property Value
TypeDescription
Dictionary<string, Func<object, object>>

ColumnMapping

The column mapping

Declaration
    public IColumnMappingCollection ColumnMapping { get; }
Property Value
TypeDescription
IColumnMappingCollection

CurrentRow

The row that is currently processed when accessing the data reader

Declaration
    public object[] CurrentRow { get; }
Property Value
TypeDescription
object[]

DataIndexForColumn

Resolves the index number for a column name

Declaration
    public Dictionary<string, int> DataIndexForColumn { get; set; }
Property Value
TypeDescription
Dictionary<string, int>

Definition

Definition of the destination table

Declaration
    public TableDefinition Definition { get; }
Property Value
TypeDescription
TableDefinition

Depth

Gets a value indicating the depth of nesting for the current row.

Declaration
    public int Depth { get; }
Property Value
TypeDescription
int

The level of nesting.

DestinationTableName

The name of the destination table

Declaration
    public string DestinationTableName { get; }
Property Value
TypeDescription
string

FieldCount

Gets the number of columns in the current row.

Declaration
    public int FieldCount { get; }
Property Value
TypeDescription
int

When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record. The default is -1.

IsClosed

Gets a value indicating whether the data reader is closed.

Declaration
    public bool IsClosed { get; }
Property Value
TypeDescription
bool

true if the data reader is closed; otherwise, false.

this[int]

Gets the column located at the specified index.

Declaration
    public object this[int i] { get; }
Parameters
TypeNameDescription
inti

The zero-based index of the column to get.

Property Value
TypeDescription
object

The column located at the specified index as an object.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

this[string]

Gets the column with the specified name.

Declaration
    public object this[string name] { get; }
Parameters
TypeNameDescription
stringname

The name of the column to find.

Property Value
TypeDescription
object

The column with the specified name as an object.

Exceptions
TypeCondition
IndexOutOfRangeException

No column with the specified name was found.

KeepIdentity

By default, identity columns are included. If set to false, identity columns will be ignored

Declaration
    public bool KeepIdentity { get; set; }
Property Value
TypeDescription
bool

ReadIndex

The row index of the current row

Declaration
    public int ReadIndex { get; }
Property Value
TypeDescription
int

RecordsAffected

Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

Declaration
    public int RecordsAffected { get; }
Property Value
TypeDescription
int

The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.

Rows

Rows/Columns ready for bulk insert

Declaration
    public List<object[]> Rows { get; set; }
Property Value
TypeDescription
List<object[]>

ValueGeneratedColumnData

A sorted list which contains data for each value generated column (the order in the object array is the same as defined in ValueGeneratedColumnNames). The key of the list is a unique sequence number, and the order matches also to each entry in the Rows.

Declaration
    public SortedList<int, object[]> ValueGeneratedColumnData { get; set; }
Property Value
TypeDescription
SortedList<int, object[]>

ValueGeneratedColumnNames

A collection of all column names that are value generated columns (e.g. columns with a COMPUTED or DEFAULT value)

Declaration
    public ICollection<string> ValueGeneratedColumnNames { get; set; }
Property Value
TypeDescription
ICollection<string>

Methods

AddSequenceColumn(string)

Allows to name a column that is specifically used as a sequence column. The column will then be treated differently.

Declaration
    public void AddSequenceColumn(string sequenceColumnName)
Parameters
TypeNameDescription
stringsequenceColumnName

Close()

Declaration
    public void Close()

Dispose()

Declaration
    public void Dispose()

Dispose(bool)

Declaration
    protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
booldisposing

GetBoolean(int)

Gets the value of the specified column as a Boolean.

Declaration
    public bool GetBoolean(int i)
Parameters
TypeNameDescription
inti

The zero-based column ordinal.

Returns
TypeDescription
bool

The value of the column.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetByte(int)

Gets the 8-bit unsigned integer value of the specified column.

Declaration
    public byte GetByte(int i)
Parameters
TypeNameDescription
inti

The zero-based column ordinal.

Returns
TypeDescription
byte

The 8-bit unsigned integer value of the specified column.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetBytes(int, long, byte[], int, int)

Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.

Declaration
    public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
Parameters
TypeNameDescription
inti

The zero-based column ordinal.

longfieldOffset

The index within the field from which to start the read operation.

byte[]buffer

The buffer into which to read the stream of bytes.

intbufferoffset

The index for buffer to start the read operation.

intlength

The number of bytes to read.

Returns
TypeDescription
long

The actual number of bytes read.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetChar(int)

Gets the character value of the specified column.

Declaration
    public char GetChar(int i)
Parameters
TypeNameDescription
inti

The zero-based column ordinal.

Returns
TypeDescription
char

The character value of the specified column.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetChars(int, long, char[], int, int)

Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.

Declaration
    public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
Parameters
TypeNameDescription
inti

The zero-based column ordinal.

longfieldoffset

The index within the row from which to start the read operation.

char[]buffer

The buffer into which to read the stream of bytes.

intbufferoffset

The index for buffer to start the read operation.

intlength

The number of bytes to read.

Returns
TypeDescription
long

The actual number of characters read.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetData(int)

Returns an IDataReader for the specified column ordinal.

Declaration
    public IDataReader GetData(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
IDataReader

The IDataReader for the specified column ordinal.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetDataTypeName(int)

Gets the data type information for the specified field.

Declaration
    public string GetDataTypeName(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
string

The data type information for the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetDataTypeName(string)

Resolves the data type name for a column

Declaration
    public string GetDataTypeName(string columnName)
Parameters
TypeNameDescription
stringcolumnName

Column name

Returns
TypeDescription
string

Data type name

GetDateTime(int)

Gets the date and time data value of the specified field.

Declaration
    public DateTime GetDateTime(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
DateTime

The date and time data value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetDecimal(int)

Gets the fixed-position numeric value of the specified field.

Declaration
    public decimal GetDecimal(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
decimal

The fixed-position numeric value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetDouble(int)

Gets the double-precision floating point number of the specified field.

Declaration
    public double GetDouble(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
double

The double-precision floating point number of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetFieldType(int)

Gets the Type information corresponding to the type of object that would be returned from GetValue(int).

Declaration
    public Type GetFieldType(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
Type

The Type information corresponding to the type of object that would be returned from GetValue(int).

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetFloat(int)

Gets the single-precision floating point number of the specified field.

Declaration
    public float GetFloat(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
float

The single-precision floating point number of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetGuid(int)

Returns the GUID value of the specified field.

Declaration
    public Guid GetGuid(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
Guid

The GUID value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetInt16(int)

Gets the 16-bit signed integer value of the specified field.

Declaration
    public short GetInt16(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
short

The 16-bit signed integer value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetInt32(int)

Gets the 32-bit signed integer value of the specified field.

Declaration
    public int GetInt32(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
int

The 32-bit signed integer value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetInt64(int)

Gets the 64-bit signed integer value of the specified field.

Declaration
    public long GetInt64(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
long

The 64-bit signed integer value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetName(int)

Gets the name for the field to find.

Declaration
    public string GetName(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
string

The name of the field or the empty string (""), if there is no value to return.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetOrdinal(string)

Return the index of the named field.

Declaration
    public int GetOrdinal(string name)
Parameters
TypeNameDescription
stringname

The name of the field to find.

Returns
TypeDescription
int

The index of the named field.

GetSchemaTable()

Returns a DataTable that describes the column metadata of the IDataReader.

Returns null if the executed command returned no resultset, or after NextResult() returns false.

Declaration
    public DataTable GetSchemaTable()
Returns
TypeDescription
DataTable

A DataTable that describes the column metadata.

Exceptions
TypeCondition
InvalidOperationException

The IDataReader is closed.

GetString(int)

Gets the string value of the specified field.

Declaration
    public string GetString(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
string

The string value of the specified field.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetTableColumn(string)

Resolves the column in the table definition

Declaration
    public TableColumn GetTableColumn(string columnName)
Parameters
TypeNameDescription
stringcolumnName

Column name

Returns
TypeDescription
TableColumn

GetValue(int)

Returns the value of the specified field.

Declaration
    public object GetValue(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
object

The field value.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

GetValues(object[])

Populates an array of objects with the column values of the current record.

Declaration
    public int GetValues(object[] values)
Parameters
TypeNameDescription
object[]values

An array of object to copy the attribute fields into.

Returns
TypeDescription
int

The number of instances of object in the array.

IsDBNull(int)

Return whether the specified field is set to null.

Declaration
    public bool IsDBNull(int i)
Parameters
TypeNameDescription
inti

The index of the field to find.

Returns
TypeDescription
bool

true if the specified field is set to null; otherwise, false.

Exceptions
TypeCondition
IndexOutOfRangeException

The index passed was outside the range of 0 through FieldCount.

NextResult()

Advances the data reader to the next result, when reading the results of batch SQL statements.

Declaration
    public bool NextResult()
Returns
TypeDescription
bool

true if there are more rows; otherwise, false.

Read()

Advances the IDataReader to the next record.

Declaration
    public bool Read()
Returns
TypeDescription
bool

true if there are more rows; otherwise, false.

RewindReadIndex(int)

The IDataReader is iterated via the Read() method - once the last record was read, the Read() will return false. If you want to iterate again, you can use this method to "rewind" and start with the first record again.

Declaration
    public void RewindReadIndex(int position = 0)
Parameters
TypeNameDescription
intposition

Implements