mondrian.spi.impl
Class InfobrightDialect

java.lang.Object
  extended by mondrian.spi.impl.JdbcDialectImpl
      extended by mondrian.spi.impl.MySqlDialect
          extended by mondrian.spi.impl.InfobrightDialect
All Implemented Interfaces:
Dialect

public class InfobrightDialect
extends MySqlDialect

Implementation of Dialect for the Infobright database.

Since:
Nov 23, 2008
Version:
$Id: //open/mondrian/src/main/mondrian/spi/impl/InfobrightDialect.java#6 $
Author:
jhyde

Nested Class Summary
 
Nested classes/interfaces inherited from interface mondrian.spi.Dialect
Dialect.DatabaseProduct, Dialect.Datatype, Dialect.NullCollation
 
Field Summary
static JdbcDialectFactory FACTORY
           
 
Fields inherited from class mondrian.spi.impl.JdbcDialectImpl
databaseProduct, permitsSelectNotInGroupBy, productVersion
 
Constructor Summary
InfobrightDialect(java.sql.Connection connection)
          Creates an InfobrightDialect.
 
Method Summary
 boolean allowsCompoundCountDistinct()
          Returns whether this Dialect allows multiple arguments to the COUNT(DISTINCT ...) aggregate function, for example SELECT COUNT(DISTINCT x, y) FROM t
 boolean allowsOrderByAlias()
          Returns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.
 java.lang.String generateOrderItem(java.lang.String expr, boolean nullable, boolean ascending)
          Generates an item for an ORDER BY clause, sorting in the required direction, and ensuring that NULL values collate after all non-NULL values.
 Dialect.DatabaseProduct getDatabaseProduct()
          Returns the database for this Dialect, or Dialect.DatabaseProduct.UNKNOWN if the database is not a common database.
 boolean requiresGroupByAlias()
          Returns true if this Dialect can include expressions in the GROUP BY clause only by adding an expression to the SELECT clause and using its alias.
 boolean requiresOrderByAlias()
          Returns true if this Dialect can include expressions in the ORDER BY clause only by adding an expression to the SELECT clause and using its alias.
 boolean supportsGroupByExpressions()
          Returns whether this Dialect supports expressions in the GROUP BY clause.
 boolean supportsMultiValueInExpr()
          Returns true if this dialect supports multi-value IN expressions.
 
Methods inherited from class mondrian.spi.impl.MySqlDialect
allowsFromQuery, appendHintsAfterFromClause, deduceIdentifierQuoteString, deduceProductName, deduceSupportsSelectNotInGroupBy, generateInline, getNullCollation, isInfobright, requiresAliasForFromQuery
 
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
allowsAs, allowsCountDistinct, allowsDdl, allowsDialectSharing, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsSelectNotInGroupBy, caseWhenElse, deduceMaxColumnNameLength, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, generateInlineForAnsi, generateInlineGeneric, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteStringLiteral, quoteTimeLiteral, quoteTimestampLiteral, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupingSets, supportsOrderByNullsLast, supportsResultSetConcurrency, supportsUnlimitedValueList, toString, toUpper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FACTORY

public static final JdbcDialectFactory FACTORY
Constructor Detail

InfobrightDialect

public InfobrightDialect(java.sql.Connection connection)
                  throws java.sql.SQLException
Creates an InfobrightDialect.

Parameters:
connection - Connection
Throws:
java.sql.SQLException
Method Detail

getDatabaseProduct

public Dialect.DatabaseProduct getDatabaseProduct()
Description copied from interface: Dialect
Returns the database for this Dialect, or Dialect.DatabaseProduct.UNKNOWN if the database is not a common database.

Specified by:
getDatabaseProduct in interface Dialect
Overrides:
getDatabaseProduct in class JdbcDialectImpl
Returns:
Database

allowsCompoundCountDistinct

public boolean allowsCompoundCountDistinct()
Description copied from interface: Dialect
Returns whether this Dialect allows multiple arguments to the COUNT(DISTINCT ...) aggregate function, for example
SELECT COUNT(DISTINCT x, y) FROM t

Specified by:
allowsCompoundCountDistinct in interface Dialect
Overrides:
allowsCompoundCountDistinct in class MySqlDialect
Returns:
whether Dialect allows multiple arguments to COUNT DISTINCT
See Also:
Dialect.allowsCountDistinct(), Dialect.allowsMultipleCountDistinct()

generateOrderItem

public java.lang.String generateOrderItem(java.lang.String expr,
                                          boolean nullable,
                                          boolean ascending)
Description copied from interface: Dialect
Generates an item for an ORDER BY clause, sorting in the required direction, and ensuring that NULL values collate after all non-NULL values.

By default, generateOrderItem(expr, true) generates "expr ASC" and generateOrderItem(expr, false) generates "expr DESC". But depending on Dialect.getNullCollation() and ascending, there may need to be additional code.

For example, on Oracle, where NULLs collate higher than all other values, generateOrderItem(expr, true) generates "expr ASC" and generateOrderItem(expr, false) generates "expr DESC NULLS LAST".

On MySQL, where NULLs collate lower than all other values, generateOrderItem(expr, true) generates "ISNULL(expr), expr ASC" and generateOrderItem(expr, false) generates "expr DESC".

Specified by:
generateOrderItem in interface Dialect
Overrides:
generateOrderItem in class MySqlDialect
Parameters:
expr - Expression
nullable - Whether expression may have NULL values
ascending - Whether to sort expression ascending
Returns:
Expression modified so that NULL values collate last

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

requiresGroupByAlias

public boolean requiresGroupByAlias()
Description copied from interface: Dialect
Returns true if this Dialect can include expressions in the GROUP BY clause only by adding an expression to the SELECT clause and using its alias.

For example, in such a dialect,

SELECT x, x FROM t GROUP BY x
would be illegal, but
SELECT x AS a, x AS b FROM t ORDER BY a, b
would be legal.

Infobright is the only such dialect.

Specified by:
requiresGroupByAlias in interface Dialect
Overrides:
requiresGroupByAlias in class JdbcDialectImpl
Returns:
Whether this Dialect can include expressions in the GROUP BY clause only by adding an expression to the SELECT clause and using its alias

allowsOrderByAlias

public boolean allowsOrderByAlias()
Description copied from interface: Dialect
Returns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.

For example, in such a dialect,

SELECT x, x + y AS z FROM t ORDER BY z
would be legal.

MySQL, DB2 and Ingres are examples of dialects where this is true; Access is a dialect where this is false.

Specified by:
allowsOrderByAlias in interface Dialect
Overrides:
allowsOrderByAlias in class JdbcDialectImpl
Returns:
Whether aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.

requiresOrderByAlias

public boolean requiresOrderByAlias()
Description copied from interface: Dialect
Returns true if this Dialect can include expressions in the ORDER BY clause only by adding an expression to the SELECT clause and using its alias.

For example, in such a dialect,

SELECT x FROM t ORDER BY x + y
would be illegal, but
SELECT x, x + y AS z FROM t ORDER BY z
would be legal.

MySQL, DB2 and Ingres are examples of such dialects.

Specified by:
requiresOrderByAlias in interface Dialect
Overrides:
requiresOrderByAlias in class MySqlDialect
Returns:
Whether this Dialect can include expressions in the ORDER BY clause only by adding an expression to the SELECT clause and using its alias

supportsMultiValueInExpr

public boolean supportsMultiValueInExpr()
Description copied from interface: Dialect
Returns true if this dialect supports multi-value IN expressions. E.g., WHERE (col1, col2) IN ((val1a, val2a), (val1b, val2b))

Specified by:
supportsMultiValueInExpr in interface Dialect
Overrides:
supportsMultiValueInExpr in class MySqlDialect
Returns:
true if the dialect supports multi-value IN expressions

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads