Class TableData
Defines a list of rows that can be inserted into a table
Inherited Members
Namespace: ETLBox.ControlFlow
Assembly: ETLBox.dll
Syntax
public class TableData : ITableData, IDataReader, IDataRecord, IDisposableConstructors
TableData(TableDefinition)
Declaration
public TableData(TableDefinition definition)Parameters
| Type | Name | Description |
|---|---|---|
| TableDefinition | definition |
TableData(TableDefinition, int)
Declaration
public TableData(TableDefinition definition, int estimatedBatchSize)Parameters
| Type | Name | Description |
|---|---|---|
| TableDefinition | definition | |
| int | estimatedBatchSize |
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
| Type | Description |
|---|---|
| bool |
ColumnConverters
Declaration
public Dictionary<string, Func<object, object>> ColumnConverters { get; set; }Property Value
| Type | Description |
|---|---|
| Dictionary<string, Func<object, object>> |
ColumnMapping
The column mapping
Declaration
public IColumnMappingCollection ColumnMapping { get; }Property Value
| Type | Description |
|---|---|
| IColumnMappingCollection |
CurrentRow
The row that is currently processed when accessing the data reader
Declaration
public object[] CurrentRow { get; }Property Value
| Type | Description |
|---|---|
| object[] |
DataIndexForColumn
Resolves the index number for a column name
Declaration
public Dictionary<string, int> DataIndexForColumn { get; set; }Property Value
| Type | Description |
|---|---|
| Dictionary<string, int> |
Definition
Definition of the destination table
Declaration
public TableDefinition Definition { get; }Property Value
| Type | Description |
|---|---|
| TableDefinition |
Depth
Gets a value indicating the depth of nesting for the current row.
Declaration
public int Depth { get; }Property Value
| Type | Description |
|---|---|
| int | The level of nesting. |
DestinationTableName
The name of the destination table
Declaration
public string DestinationTableName { get; }Property Value
| Type | Description |
|---|---|
| string |
FieldCount
Gets the number of columns in the current row.
Declaration
public int FieldCount { get; }Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| bool |
this[int]
Gets the column located at the specified index.
Declaration
public object this[int i] { get; }Parameters
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based index of the column to get. |
Property Value
| Type | Description |
|---|---|
| object | The column located at the specified index as an object. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| string | name | The name of the column to find. |
Property Value
| Type | Description |
|---|---|
| object | The column with the specified name as an object. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Description |
|---|---|
| bool |
ReadIndex
The row index of the current row
Declaration
public int ReadIndex { get; }Property Value
| Type | Description |
|---|---|
| int |
RecordsAffected
Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Declaration
public int RecordsAffected { get; }Property Value
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| string | sequenceColumnName |
Close()
Declaration
public void Close()Dispose()
Declaration
public void Dispose()Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
GetBoolean(int)
Gets the value of the specified column as a Boolean.
Declaration
public bool GetBoolean(int i)Parameters
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based column ordinal. |
Returns
| Type | Description |
|---|---|
| bool | The value of the column. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based column ordinal. |
Returns
| Type | Description |
|---|---|
| byte | The 8-bit unsigned integer value of the specified column. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based column ordinal. |
| long | fieldOffset | The index within the field from which to start the read operation. |
| byte[] | buffer | The buffer into which to read the stream of bytes. |
| int | bufferoffset | The index for |
| int | length | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| long | The actual number of bytes read. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based column ordinal. |
Returns
| Type | Description |
|---|---|
| char | The character value of the specified column. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The zero-based column ordinal. |
| long | fieldoffset | The index within the row from which to start the read operation. |
| char[] | buffer | The buffer into which to read the stream of bytes. |
| int | bufferoffset | The index for |
| int | length | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| long | The actual number of characters read. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| IDataReader | The IDataReader for the specified column ordinal. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| string | The data type information for the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| string | columnName | Column name |
Returns
| Type | Description |
|---|---|
| string | Data type name |
GetDateTime(int)
Gets the date and time data value of the specified field.
Declaration
public DateTime GetDateTime(int i)Parameters
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| DateTime | The date and time data value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| decimal | The fixed-position numeric value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| double | The double-precision floating point number of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| Type | The Type information corresponding to the type of object that would be returned from GetValue(int). |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| float | The single-precision floating point number of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| Guid | The GUID value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| short | The 16-bit signed integer value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| int | The 32-bit signed integer value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| long | The 64-bit signed integer value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| string | The name of the field or the empty string (""), if there is no value to return. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| string | name | The name of the field to find. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| DataTable | A DataTable that describes the column metadata. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The IDataReader is closed. |
GetString(int)
Gets the string value of the specified field.
Declaration
public string GetString(int i)Parameters
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| string | The string value of the specified field. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| string | columnName | Column name |
Returns
| Type | Description |
|---|---|
| TableColumn |
GetValue(int)
Returns the value of the specified field.
Declaration
public object GetValue(int i)Parameters
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| object | The field value. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| object[] | values | An array of object to copy the attribute fields into. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| int | i | The index of the field to find. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified field is set to null; otherwise, false. |
Exceptions
| Type | Condition |
|---|---|
| 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
| Type | Description |
|---|---|
| bool |
Read()
Advances the IDataReader to the next record.
Declaration
public bool Read()Returns
| Type | Description |
|---|---|
| bool |
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
| Type | Name | Description |
|---|---|---|
| int | position |