Search Results for

    Show / Hide Table of Contents

    Class AdbTableCommandServiceBase

    A base class with default implementations for some of the methods in IAdbTableCommandService, an optional service which executes predefined table commands (truncate, drop, delete all rows). This class is normally not used directly by the user, but instead via TableCommand. You can however derive from this class to customize the information for either the same .NET provider, or for a different but similar .NET provider, if some of these default implementations work correctly on your database. Otherwise create a new implementation from scratch.

    Also see HasTableCommandService, AdbTableInformation, AdbDataSourceInformation, AdbConnection and AdbProvider.

    Inheritance
    Object
    AdbTableCommandServiceBase
    AdbMySqlClientTableCommandService
    AdbMySqlConnectorTableCommandService
    AdbNpgsqlTableCommandService
    AdbSqlClientTableCommandService
    AdbSQLiteTableCommandService
    Implements
    IAdbTableCommandService
    Namespace: actionETL.Adb
    Assembly: actionETL.dll
    Syntax
    public abstract class AdbTableCommandServiceBase : IAdbTableCommandService

    Constructors

    AdbTableCommandServiceBase(IAdbConnection)

    Initializes a new instance of the AdbTableCommandServiceBase class, which executes predefined commands (table truncate, drop, delete, exists).

    Declaration
    protected AdbTableCommandServiceBase(IAdbConnection adbConnection)
    Parameters
    Type Name Description
    IAdbConnection adbConnection

    A database connection.

    Properties

    Connection

    Gets the database connection to run commands on.

    Declaration
    protected IAdbConnection Connection { get; }
    Property Value
    Type Description
    IAdbConnection

    Methods

    DeleteRowsAsync(String)

    Delete all rows in a table-like object (e.g. table or view), using the SQL text: DELETE FROM MyCompositeTableName.

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

    Declaration
    public virtual Task<OutcomeStatusResult<int>> DeleteRowsAsync(string compositeTableName)
    Parameters
    Type Name Description
    String compositeTableName

    Table to delete rows from. Can be a composite name.

    Returns
    Type Description
    Task<OutcomeStatusResult<Int32>>

    On success, Status will be Succeeded, and Result will be the number of rows affected.

    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.

    DropTableAsync(String, Boolean)

    Drop a table.

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

    This AdbTableCommandServiceBase implementation uses a DROP TABLE IF EXISTS syntax; override it in derived classes if necessary.

    Declaration
    public virtual async Task<OutcomeStatus> DropTableAsync(string compositeTableName, bool ifExists)
    Parameters
    Type Name Description
    String compositeTableName

    Table to drop. Can be a composite name.

    Boolean ifExists

    If true, only drop the table if it exists. If false, always drop the table, which will fail if it doesn't exist.

    Returns
    Type Description
    Task<OutcomeStatus>

    An OutcomeStatus, with Succeeded on success; otherwise one of the failure states.

    DropViewAsync(String, Boolean)

    Drop a view.

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

    This AdbTableCommandServiceBase implementation uses a DROP VIEW IF EXISTS syntax; override it in derived classes if necessary.

    Declaration
    public virtual async Task<OutcomeStatus> DropViewAsync(string compositeViewName, bool ifExists)
    Parameters
    Type Name Description
    String compositeViewName

    View to drop. Can be a composite name.

    Boolean ifExists

    If true, only drop the view if it exists. If false, always drop the view, which will fail if it doesn't exist.

    Returns
    Type Description
    Task<OutcomeStatus>

    An OutcomeStatus, with Succeeded on success; otherwise one of the failure states.

    TruncateTableAsync(String)

    Truncates a table, using the SQL text: TRUNCATE TABLE MyCompositeTableName.

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

    Declaration
    public virtual async Task<OutcomeStatus> TruncateTableAsync(string compositeTableName)
    Parameters
    Type Name Description
    String compositeTableName

    Table to truncate. Can be a composite name.

    Returns
    Type Description
    Task<OutcomeStatus>

    An OutcomeStatus, with Succeeded on success; otherwise one of the failure states.

    Implements

    IAdbTableCommandService

    See Also

    HasTableCommandService
    AdbDataSourceInformation
    AdbConnection
    AdbProvider
    In This Article
    Back to top Copyright © 2023 Envobi Ltd