Search Results for

    Show / Hide Table of Contents

    Class AdbGenericDataSourceInformationService

    Base class that provides information about a data source behind a connection, such as what character to use for quoting, how to specify parameter markers etc. The information is mainly taken from the "DataSourceInformation" schema collection, and is used to write provider-independent database code.

    This class can be used directly (if the settings works with your data source) when creating AdbProvider instances, use Get() to retrieve the required delegate. It supports positional parameters, and named parameters using @ or :. Commonly, this class is inherited by provider-specific classes, which typically overwrites some values.

    Also see Information and AdbProvider.

    This class is immutable. This avoids threading issues, since an instance is often accessed by multiple threads. Any user custom provider services should also be immutable for the same reason.

    Inheritance
    Object
    AdbGenericDataSourceInformationService
    AdbMySqlClientDataSourceInformationService
    AdbMySqlConnectorDataSourceInformationService
    AdbNpgsqlDataSourceInformationService
    AdbOdbcDataSourceInformationService
    AdbSqlClientDataSourceInformationService
    AdbSQLiteDataSourceInformationService
    Implements
    IAdbDataSourceInformationService
    Namespace: actionETL.Adb
    Assembly: actionETL.dll
    Syntax
    public class AdbGenericDataSourceInformationService : IAdbDataSourceInformationService

    Constructors

    AdbGenericDataSourceInformationService(IAdbConnection)

    Initializes a new instance of the AdbGenericDataSourceInformationService class, which provides information about a data source behind a connection, such as what character to use for quoting, how to specify parameter markers etc. This supports writing provider-independent database code. It supports positional parameters, and named parameters using @ or :.

    The connection is opened if needed, and is closed before returning if (and only if) it was closed before the call.

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

    An Adb database connection.

    Exceptions
    Type Condition
    ArgumentNullException

    adbConnection

    Exception

    (See the provider documentation for specific Open() exceptions.)

    InvalidOperationException

    May throw if the connection is associated with a transaction (this is provider dependent).

    Properties

    CompositeIdentifierSeparator

    Gets or sets the primary composite identifier separator, that e.g. separates the table name from the schema name.

    Note that some providers use a different character when including e.g. the database name. Therefore always use the methods in AdbTableInformation to manipulate table identifiers, such as ComposeTableIdentifierParts(String, String, String) and CreateTableIdentifier(String).

    Declaration
    public string CompositeIdentifierSeparator { get; protected set; }
    Property Value
    Type Description
    String

    CompositeIdentifierSeparatorPattern

    Gets the composite identifier separator regular expression pattern.

    Declaration
    public string CompositeIdentifierSeparatorPattern { get; protected set; }
    Property Value
    Type Description
    String

    Connection

    Gets the Adb database connection.

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

    DataSourceProductName

    Gets the name of the data source product.

    Declaration
    public string DataSourceProductName { get; protected set; }
    Property Value
    Type Description
    String

    DataSourceProductVersion

    Gets the data source product version.

    Declaration
    public string DataSourceProductVersion { get; protected set; }
    Property Value
    Type Description
    String

    DataSourceProductVersionNormalized

    Gets the normalized data source product version, which is easier (vs. DataSourceProductVersion) to compare to find out which version is greater.

    Declaration
    public string DataSourceProductVersionNormalized { get; protected set; }
    Property Value
    Type Description
    String

    GroupByBehavior

    Gets the relationship between the columns in a GROUP BY clause and the non-aggregated columns in the select-list of a SELECT statement.

    Declaration
    public GroupByBehavior GroupByBehavior { get; protected set; }
    Property Value
    Type Description
    GroupByBehavior

    IdentifierCase

    Gets how identifiers are treated by the data source when searching the system catalog.

    Declaration
    public IdentifierCase IdentifierCase { get; protected set; }
    Property Value
    Type Description
    IdentifierCase

    IdentifierPattern

    Gets the regular expression pattern that matches an unquoted (non-composite) identifier and has a match value of the identifier, or the empty string if not available.

    Declaration
    public string IdentifierPattern { get; protected set; }
    Property Value
    Type Description
    String

    For example [A-Za-z0-9_#$].

    IdentifierQuotePrefix

    Gets or sets the identifier quote prefix, i.e. the quote string used on the left side of an identifier part.

    Declaration
    public string IdentifierQuotePrefix { get; protected set; }
    Property Value
    Type Description
    String

    IdentifierQuotePrefixes

    Gets or sets the identifier quote prefixes, i.e. all possible quote characters used on the left side of an identifier part.

    Declaration
    public string IdentifierQuotePrefixes { get; protected set; }
    Property Value
    Type Description
    String

    IdentifierQuoteSuffix

    Gets or sets the identifier quote suffix, i.e. the quote string used on the right side of an identifier part.

    Declaration
    public string IdentifierQuoteSuffix { get; protected set; }
    Property Value
    Type Description
    String

    IdentifierQuoteSuffixes

    Gets or sets the identifier quote suffixes, i.e. all possible quote characters used on the right side of an identifier part.

    Declaration
    public string IdentifierQuoteSuffixes { get; protected set; }
    Property Value
    Type Description
    String

    OrderByColumnsInSelect

    Gets whether columns in an ORDER BY clause must be in the select list.

    Declaration
    public bool OrderByColumnsInSelect { get; protected set; }
    Property Value
    Type Description
    Boolean

    true if they are required to be in the select list, otherwise false.

    ParameterMarker

    Gets or sets the query parameter marker (i.e. placeholder), e.g. ?, @ or :.

    Declaration
    protected string ParameterMarker { get; set; }
    Property Value
    Type Description
    String

    ParameterMarkerFormat

    Gets a format string that can be used to format a parameter.

    If named parameters are not supported, and the provider expects the use of the ? character, the format string should be ?, which would ignore the parameter name.

    Declaration
    public string ParameterMarkerFormat { get; protected set; }
    Property Value
    Type Description
    String

    For example :{0} if named parameters are prefixed with a colon. If the names already include the prefix, this string would be {0}.

    ParameterMarkerPattern

    Gets a regular expression pattern that matches a parameter marker, and with a match value of the parameter name, if any.

    Declaration
    public string ParameterMarkerPattern { get; protected set; }
    Property Value
    Type Description
    String

    The regular expression parameter marker pattern.

    For example, if named parameters are supported with an @ prefix that is included in the parameter name, this could be: (@[A-Za-z0-9_$#]*).

    If named parameters instead are supported with a : prefix and it is not part of the parameter name, this could be: :([A-Za-z0-9_$#]*).

    If named parameters are not supported, this would be ?.

    ParameterNameMaxLength

    Gets the maximum length in characters of the parameter name, or 0 if parameter names are not supported.

    Declaration
    public int ParameterNameMaxLength { get; protected set; }
    Property Value
    Type Description
    Int32

    ParameterNamePattern

    Gets the regular expression pattern that matches valid parameter names.

    Declaration
    public string ParameterNamePattern { get; protected set; }
    Property Value
    Type Description
    String

    QuotedIdentifierCase

    Gets whether quoted identifiers are treated as case sensitive or not.

    Declaration
    public IdentifierCase QuotedIdentifierCase { get; protected set; }
    Property Value
    Type Description
    IdentifierCase

    QuotedIdentifierPattern

    Gets a regular expression that matches a quoted (non-composite) identifier and has a match value of the identifier itself without the quotes.

    Declaration
    public string QuotedIdentifierPattern { get; protected set; }
    Property Value
    Type Description
    String

    The quoted identifier regular expression pattern. For example, if the data source uses double-quotes to identify quoted identifiers, this would be: (([^\"]|\"\")*).

    StatementSeparatorPattern

    Gets a regular expression pattern that matches the statement separator.

    Declaration
    public string StatementSeparatorPattern { get; protected set; }
    Property Value
    Type Description
    String

    StringLiteralPattern

    Gets a regular expression pattern that matches a string literal, and has a match value of the literal itself.

    Declaration
    public string StringLiteralPattern { get; protected set; }
    Property Value
    Type Description
    String

    For example, if the data source uses single-quotes to identify strings, this would be: ('([^']|'')*')

    SupportedJoinOperators

    Gets the supported join operators.

    Declaration
    public SupportedJoinOperators SupportedJoinOperators { get; }
    Property Value
    Type Description
    SupportedJoinOperators

    UsesPositionalParameters

    Gets or sets whether the provider uses positional (true) or named (false) parameters. Defaults to true if ParameterMarkerFormat equals "?"; otherwise false. Also see GetPlaceholder(String).

    Declaration
    public bool UsesPositionalParameters { get; protected set; }
    Property Value
    Type Description
    Boolean

    Methods

    Get()

    Gets a function that returns a new instance of AdbGenericDataSourceInformationService (with default settings) on each invocation, which is used when instantiating a new AdbProvider.

    Declaration
    public static Func<IAdbConnection, IAdbDataSourceInformationService> Get()
    Returns
    Type Description
    Func<IAdbConnection, IAdbDataSourceInformationService>

    GetPlaceholder(String)

    Returns the parameter placeholder string, for creating SQL queries. Only supports ? for positional parameters, as well as @ (e.g. @MyName) and : (e.g. :MyName for prefix named parameters. Override this method if this is not correct.

    Declaration
    public virtual string GetPlaceholder(string parameterName)
    Parameters
    Type Name Description
    String parameterName

    The parameter name, with or without a parameter marker.

    Returns
    Type Description
    String

    The parameter placeholder, ? for positional parameters, or e.g. @MyName or :MyName for named parameters.

    Exceptions
    Type Condition
    ArgumentException

    parameterName - Must not be empty.

    QuoteIdentifierPart(String)

    Quotes the table or column identifier part, i.e. column name, table name, schema/owner name, or database/catalog name. Does not quote it if it's already quoted with IdentifierQuotePrefix and IdentifierQuoteSuffix.

    Declaration
    public virtual string QuoteIdentifierPart(string unquotedIdentifierPart)
    Parameters
    Type Name Description
    String unquotedIdentifierPart

    The potentially unquoted identifier part.

    Returns
    Type Description
    String

    The quoted identifier part. null if unquotedIdentifierPart is null. An empty string if unquotedIdentifierPart is an empty string.

    StripParameterMarker(String)

    Returns the specified parameter name with a parameter marker removed (if present), if the provider uses named parameters. Otherwise the parameter name is returned unchanged.

    Supports named parameters that uses @ and : prefixes, override the method if this is not sufficient.

    Declaration
    public virtual string StripParameterMarker(string parameterName)
    Parameters
    Type Name Description
    String parameterName

    The parameter name, with or without a parameter marker.

    Returns
    Type Description
    String

    The parameter name, with any parameter marker removed.

    Exceptions
    Type Condition
    ArgumentNullException

    parameterName

    ToString()

    Returns a string that represents this instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    Implements

    IAdbDataSourceInformationService

    See Also

    Information
    In This Article
    Back to top Copyright © 2023 Envobi Ltd