Search Results for

    Show / Hide Table of Contents

    Class AdbTableInformation

    An optional service that manipulates table identifiers and provides information about table-like objects, such as which ones exists and what their type is (table, view, etc), and which columns are present. This assists with writing provider-independent database code, and is available as TableInformation, if the provider supports it. Also see HasTableInformationService, AdbTableCommand, AdbDataSourceInformation and AdbConnection.

    Inheritance
    Object
    AdbTableInformation
    Namespace: actionETL.Adb
    Assembly: actionETL.dll
    Syntax
    public class AdbTableInformation

    Methods

    ComposeTableIdentifierParts(String, String, String)

    Composes the table identifier parts into a composite table identifier string.

    Each specified part must follow the quoting requirements of the provider, e.g. use quoting due to potential spaces in the part name (i.e. parts won't be automatically quoted). Use QuoteIdentifierPart(String) to automatically quote a part.

    Declaration
    public string ComposeTableIdentifierParts(string quotedTableName, string quotedSchemaName, string quotedCatalogName)
    Parameters
    Type Name Description
    String quotedTableName

    Name of the table, with quoting if required. Cannot be null or only whitespace.

    String quotedSchemaName

    Name of the schema, with quoting if required, or null to not set it.

    String quotedCatalogName

    Name of the catalog, with quoting if required, or null to not set it. Catalog is the database if the provider (e.g. SqlClient) uses schemas; otherwise unused (e.g. MySqlClient provider).

    Returns
    Type Description
    String

    The combined table identifier string.

    Exceptions
    Type Condition
    ArgumentException

    quotedTableName - Cannot be null or only whitespace.

    CreateTableIdentifier(String)

    Creates an identifier for a table-like database object from a composite name, i.e. it splits a potentially delimited table name into its constituent parts, i.e. database or catalog name, schema or owner name, and table name. Depending on the provider, the identifier can be either system or user regular tables, temporary tables, views, table-valued functions, etc.

    Note that some providers do not support all identifier parts; unsupported parts will be set to null, but unused parts will be set to an empty string. While the SqlClient provider puts the database and schema in the CatalogName and SchemaName properties respectively, the MySqlClient provider puts the database in the SchemaName property.

    Declaration
    public IAdbTableIdentifier CreateTableIdentifier(string compositeTableName)
    Parameters
    Type Name Description
    String compositeTableName

    Name of the table, potentially including database or catalog name, and schema or owner name.

    The string must be formatted according to the requirements of the data source, i.e. use the appropriate quoting characters and delimiters, in the appropriate order.

    Returns
    Type Description
    IAdbTableIdentifier

    A table identifier.

    Exceptions
    Type Condition
    ArgumentException

    compositeTableName cannot be null or only whitespace.

    GetTableColumnsAsync(IAdbTableIdentifier)

    Gets information (name, data type etc.) about all columns in a table-like database object. Depending on the provider, this can include both system and user regular tables, temporary tables, views, table-valued functions, etc.

    Note that it does not include objects that do not themselves have columns, e.g. stored procedures.

    Note that this method does not log errors. Instead the caller should normally log any returned failure status.

    Declaration
    public Task<OutcomeStatusResult<IList<AdbColumnSchema>>> GetTableColumnsAsync(IAdbTableIdentifier tableIdentifier)
    Parameters
    Type Name Description
    IAdbTableIdentifier tableIdentifier

    The identifier for a table-like object to check. It must specify table name, but schema and/or catalog names can be null, in which case the current schema and catalog for the connection is used. Providers where 'database' and 'schema' means the same thing, i.e. MySqlClient, put the database/schema in the schema property.

    Returns
    Type Description
    Task<OutcomeStatusResult<IList<AdbColumnSchema>>>

    On success, Status will be Succeeded, and Result will be populated with the table columns.

    On failure, Status will have a failure status, and Result will be null.

    An incorrect parameter will throw immediately. Any other exceptions or failures will be caught and contained in the returned OutcomeStatus, which should then be logged by the caller. If a .NET provider doesn't support retrieving this information, an Error status with a NotSupportedException is returned.

    See the provider documentation for specific Open() exceptions. Some providers may throw if the connection is associated with a transaction.

    Exceptions
    Type Condition
    ArgumentException

    tableIdentifier.UnquotedTableName cannot be null or only whitespace.

    ArgumentNullException

    tableIdentifier

    GetTableColumnsAsync(String)

    Gets information (name, data type etc.) about all columns in a table-like database object. Depending on the provider, this can include both system and user regular tables, temporary tables, views, table-valued functions, etc.

    Note that it does not include objects that do not themselves have columns, e.g. stored procedures.

    Note that this method does not log errors. Instead the caller should normally log any returned failure status.

    Declaration
    public Task<OutcomeStatusResult<IList<AdbColumnSchema>>> GetTableColumnsAsync(string compositeTableName)
    Parameters
    Type Name Description
    String compositeTableName

    The composite name of the table (or view, ...) to return column information from. It must specify table name, but schema/owner and/or database/catalog names can be omitted, in which case the current schema and database for the connection is used.

    Returns
    Type Description
    Task<OutcomeStatusResult<IList<AdbColumnSchema>>>

    On success, Status will be Succeeded, and Result will be populated with the table columns.

    On failure, Status will have a failure status, and Result will be null.

    An incorrect parameter will throw immediately. Any other exceptions or failures will be caught and contained in the returned OutcomeStatus, which should then be logged by the caller. If a .NET provider doesn't support retrieving this information, an Error status with a NotSupportedException is returned.

    See the provider documentation for specific Open() exceptions. Some providers may throw if the connection is associated with a transaction.

    Exceptions
    Type Condition
    ArgumentException

    compositeTableName cannot be null or only whitespace.

    GetTableTypeAsync(IAdbTableIdentifier)

    Check if a table-like object exists, and what type it is. Depending on provider, this can e.g. be a regular table, temporary table, view, table-valued function etc. It does not include stored procedures etc. that do not themselves have columns.

    Note that this method does not log errors. Instead the caller should normally log any returned failure status.

    Declaration
    public Task<OutcomeStatusResult<AdbTableType>> GetTableTypeAsync(IAdbTableIdentifier tableIdentifier)
    Parameters
    Type Name Description
    IAdbTableIdentifier tableIdentifier

    The identifier for a table-like object to check. It must specify table name, but schema and/or catalog names can be null, in which case the current schema and catalog for the connection is used. Providers where 'database' and 'schema' means the same thing, i.e. MySqlClient, put the database/schema in the schema property.

    Returns
    Type Description
    Task<OutcomeStatusResult<AdbTableType>>

    On success, Status will be Succeeded, and Result will describe if the table exists, and if so, what type (table, view, etc.)

    On failure, Status will have a failure status, and Result will be undefined.

    An incorrect parameter will throw immediately. Any other exceptions or failures will be caught and contained in the returned OutcomeStatus, which should then be logged by the caller.

    See the provider documentation for specific Open() exceptions. Some providers may throw if the connection is associated with a transaction.

    Exceptions
    Type Condition
    ArgumentException

    tableIdentifier.UnquotedTableName cannot be null or only whitespace.

    ArgumentNullException

    tableIdentifier

    GetTableTypeAsync(String)

    Check if a table-like object exists, and what type it is. Depending on provider, this can e.g. be a regular table, temporary table, view, table-valued function etc. It does not include stored procedures etc. that do not themselves have columns.

    Note that this method does not log errors. Instead the caller should normally log any returned failure status.

    Declaration
    public Task<OutcomeStatusResult<AdbTableType>> GetTableTypeAsync(string compositeTableName)
    Parameters
    Type Name Description
    String compositeTableName

    The name of a table-like object to check. It must specify table name, but schema and/or database names can be null, in which case the current schema and database for the connection is used.

    Returns
    Type Description
    Task<OutcomeStatusResult<AdbTableType>>

    On success, Status will be Succeeded, and Result will describe if the table exists, and if so, what type (table, view, etc.)

    On failure, Status will have a failure status, and Result will be undefined.

    An incorrect parameter will throw immediately. Any other exceptions or failures will be caught and contained in the returned OutcomeStatus, which should then be logged by the caller.

    See the provider documentation for specific Open() exceptions. Some providers may throw if the connection is associated with a transaction.

    Exceptions
    Type Condition
    ArgumentException

    compositeTableName cannot be null or only whitespace.

    See Also

    TableInformation
    HasTableInformationService
    AdbTableCommand
    AdbDataSourceInformation
    AdbConnection
    AdbProvider
    In This Article
    Back to top Copyright © 2021 Envobi Ltd