Class MonetDbDialect

  • All Implemented Interfaces:
    Dialect

    public class MonetDbDialect
    extends JdbcDialectImpl
    Implementation of Dialect for the MonetDB database.
    Since:
    Nov 10, 2012
    Author:
    pstoellberger
    • Constructor Detail

      • MonetDbDialect

        public MonetDbDialect​(Connection connection)
                       throws SQLException
        Creates a MonetDbDialect.
        Parameters:
        connection - Connection
        Throws:
        SQLException - on error
      • MonetDbDialect

        public MonetDbDialect()
    • Method Detail

      • allowsCountDistinct

        public boolean allowsCountDistinct()
        Description copied from interface: Dialect
        Returns whether this Dialect supports distinct aggregations.

        For example, Access does not allow

        select count(distinct x) from t
        Specified by:
        allowsCountDistinct in interface Dialect
        Overrides:
        allowsCountDistinct in class JdbcDialectImpl
        Returns:
        whether Dialect allows COUNT DISTINCT
      • allowsCountDistinctWithOtherAggs

        public boolean allowsCountDistinctWithOtherAggs()
        Description copied from interface: Dialect
        Returns whether this Dialect supports distinct aggregations with other aggregations in the same query. This may be enabled for performance reasons (Vertica)
        Specified by:
        allowsCountDistinctWithOtherAggs in interface Dialect
        Overrides:
        allowsCountDistinctWithOtherAggs in class JdbcDialectImpl
        Returns:
        whether this Dialect supports more than one distinct aggregation in the same query
      • allowsMultipleCountDistinct

        public boolean allowsMultipleCountDistinct()
        Description copied from interface: Dialect
        Returns whether this Dialect supports more than one distinct aggregation in the same query.

        In Derby 10.1,

        select couunt(distinct x) from t
        is OK, but
        select couunt(distinct x), count(distinct y) from t
        gives "Multiple DISTINCT aggregates are not supported at this time."
        Specified by:
        allowsMultipleCountDistinct in interface Dialect
        Overrides:
        allowsMultipleCountDistinct in class JdbcDialectImpl
        Returns:
        whether this Dialect supports more than one distinct aggregation in the same query
      • supportsGroupByExpressions

        public boolean supportsGroupByExpressions()
        Description copied from interface: Dialect
        Returns whether this Dialect supports expressions in the GROUP BY clause. Derby/Cloudscape and Infobright do not.
        Specified by:
        supportsGroupByExpressions in interface Dialect
        Overrides:
        supportsGroupByExpressions in class JdbcDialectImpl
        Returns:
        Whether this Dialect allows expressions in the GROUP BY clause
      • quoteStringLiteral

        public void quoteStringLiteral​(StringBuilder buf,
                                       String s)
        Description copied from interface: Dialect
        Appends to a buffer a single-quoted SQL string.

        For example, in the default dialect, quoteStringLiteral(buf, "Can't") appends "'Can''t'" to buf.

        Specified by:
        quoteStringLiteral in interface Dialect
        Overrides:
        quoteStringLiteral in class JdbcDialectImpl
        Parameters:
        buf - Buffer to append to
        s - Literal
      • getType

        public SqlStatement.Type getType​(ResultSetMetaData metaData,
                                         int columnIndex)
                                  throws SQLException
        Description copied from interface: Dialect

        Chooses the most appropriate type for accessing the values of a column in a result set for a dialect.

        Dialect-specific nuances involving type representation should be encapsulated in implementing methods. For example, if a dialect has implicit rules involving scale or precision, they should be handled within this method so the client can simply retrieve the "best fit" SqlStatement.Type for the column.

        Specified by:
        getType in interface Dialect
        Overrides:
        getType in class JdbcDialectImpl
        Parameters:
        metaData - Results set metadata
        columnIndex - Column ordinal (0-based)
        Returns:
        the most appropriate SqlStatement.Type for the column
        Throws:
        SQLException
      • compareVersions

        public int compareVersions​(String v1,
                                   String v2)
        Compares two MonetDB versions that contain only digits separated by dots.

        Examples of MonetDB versions:

        11.17.17

        11.5.3

        Parameters:
        v1 - the first version be compared
        v2 - the second version to be compared
        Returns:
        the value 0 if two versions are equal; a value less than 0 if the first version number is less than the second one; and a value greater than 0 if the first version number is greater than the second one.