Class AccessDialect
- java.lang.Object
 - 
- mondrian.spi.impl.JdbcDialectImpl
 - 
- mondrian.spi.impl.AccessDialect
 
 
 
- 
- All Implemented Interfaces:
 Dialect
public class AccessDialect extends JdbcDialectImpl
Implementation ofDialectfor the Microsoft Access database (also called the JET Engine).- Since:
 - Nov 23, 2008
 - Author:
 - jhyde
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface mondrian.spi.Dialect
Dialect.DatabaseProduct, Dialect.Datatype 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description static JdbcDialectFactoryFACTORY- 
Fields inherited from class mondrian.spi.impl.JdbcDialectImpl
databaseProduct, permitsSelectNotInGroupBy, productVersion 
 - 
 
- 
Constructor Summary
Constructors Constructor Description AccessDialect(Connection connection)Creates an AccessDialect. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowsCountDistinct()Returns whether this Dialect supports distinct aggregations.StringcaseWhenElse(String cond, String thenExpr, String elseExpr)Generates a conditional statement in this dialect's syntax.StringgenerateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)Generates a SQL statement to represent an inline dataset.protected StringgenerateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)Generates SQL to force null values to collate last.protected voidquoteDateLiteral(StringBuilder buf, String value, Date date)Helper method forJdbcDialectImpl.quoteDateLiteral(StringBuilder, String).booleanrequiresUnionOrderByExprToBeInSelectClause()Returns true if this dialect allows an expression in the ORDER BY clause of a UNION (or other set operation) query only if it occurs in the SELECT clause.StringtoUpper(String expr)Converts an expression to upper case.- 
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
allowsAs, allowsCompoundCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsOrderByAlias, allowsRegularExpressionInWhereClause, allowsSelectNotInGroupBy, appendHintsAfterFromClause, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNullsAnsi, generateOrderItem, generateRegularExpression, getDatabaseProduct, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, getStatisticsProviders, getType, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteStringLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresAliasForFromQuery, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsMultiValueInExpr, supportsResultSetConcurrency, supportsUnlimitedValueList, toString 
 - 
 
 - 
 
- 
- 
Field Detail
- 
FACTORY
public static final JdbcDialectFactory FACTORY
 
 - 
 
- 
Constructor Detail
- 
AccessDialect
public AccessDialect(Connection connection) throws SQLException
Creates an AccessDialect.- Parameters:
 connection- Connection- Throws:
 SQLException
 
 - 
 
- 
Method Detail
- 
toUpper
public String toUpper(String expr)
Description copied from interface:DialectConverts an expression to upper case.For example, for MySQL,
toUpper("foo.bar")returns"UPPER(foo.bar)".- Specified by:
 toUpperin interfaceDialect- Overrides:
 toUpperin classJdbcDialectImpl- Parameters:
 expr- SQL expression- Returns:
 - SQL syntax that converts 
exprinto upper case. 
 
- 
caseWhenElse
public String caseWhenElse(String cond, String thenExpr, String elseExpr)
Description copied from interface:DialectGenerates a conditional statement in this dialect's syntax.For example,
caseWhenElse("b", "1", "0")returns"case when b then 1 else 0 end"on Oracle,"Iif(b, 1, 0)"on Access.- Specified by:
 caseWhenElsein interfaceDialect- Overrides:
 caseWhenElsein classJdbcDialectImpl- Parameters:
 cond- Predicate expressionthenExpr- Expression if condition is trueelseExpr- Expression if condition is false- Returns:
 - Conditional expression
 
 
- 
quoteDateLiteral
protected void quoteDateLiteral(StringBuilder buf, String value, Date date)
Description copied from class:JdbcDialectImplHelper method forJdbcDialectImpl.quoteDateLiteral(StringBuilder, String).- Overrides:
 quoteDateLiteralin classJdbcDialectImpl- Parameters:
 buf- Buffer to append tovalue- Value as stringdate- Value as date
 
- 
generateOrderByNulls
protected String generateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)
Description copied from class:JdbcDialectImplGenerates SQL to force null values to collate last.This default implementation makes use of the ANSI SQL 1999 CASE-WHEN-THEN-ELSE in conjunction with IS NULL syntax. The resulting SQL will look something like this:
CASE WHEN "expr" IS NULL THEN 0 ELSE 1 ENDYou can override this method for a particular database to use something more efficient, like ISNULL().
ANSI SQL provides the syntax "ASC/DESC NULLS LAST" and "ASC/DESC NULLS FIRST". If your database supports the ANSI syntax, implement this method by calling
JdbcDialectImpl.generateOrderByNullsAnsi(java.lang.String, boolean, boolean).This method is only called from
JdbcDialectImpl.generateOrderItem(String, boolean, boolean, boolean). Some dialects override that method and therefore never call this method.- Overrides:
 generateOrderByNullsin classJdbcDialectImpl- Parameters:
 expr- Expression.ascending- Whether ascending.collateNullsLast- Whether nulls should appear first or last.- Returns:
 - Expression to force null values to collate last or first.
 
 
- 
requiresUnionOrderByExprToBeInSelectClause
public boolean requiresUnionOrderByExprToBeInSelectClause()
Description copied from interface:DialectReturns true if this dialect allows an expression in the ORDER BY clause of a UNION (or other set operation) query only if it occurs in the SELECT clause.For example,
SELECT x, y + z FROM tis allowed but
UNION ALL
SELECT x, y + z FROM t
ORDER BY y + zSELECT x, y, z FROM t
UNION ALL
SELECT x, y, z FROM t
ORDER BY y + zSELECT x, y, z FROM t ORDER BY y + zis not.Access is an example of a dialect with this restriction.
- Specified by:
 requiresUnionOrderByExprToBeInSelectClausein interfaceDialect- Overrides:
 requiresUnionOrderByExprToBeInSelectClausein classJdbcDialectImpl- Returns:
 - whether this dialect allows an expression in the ORDER BY clause of a UNION (or other set operation) query only if it occurs in the SELECT clause
 
 
- 
allowsCountDistinct
public boolean allowsCountDistinct()
Description copied from interface:DialectReturns whether this Dialect supports distinct aggregations.For example, Access does not allow
select count(distinct x) from t- Specified by:
 allowsCountDistinctin interfaceDialect- Overrides:
 allowsCountDistinctin classJdbcDialectImpl- Returns:
 - whether Dialect allows COUNT DISTINCT
 
 
- 
generateInline
public String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
Description copied from interface:DialectGenerates a SQL statement to represent an inline dataset.For example, for Oracle, generates
SELECT 1 AS FOO, 'a' AS BAR FROM dual UNION ALL SELECT 2 AS FOO, 'b' AS BAR FROM dual
For ANSI SQL, generates:
VALUES (1, 'a'), (2, 'b')
- Specified by:
 generateInlinein interfaceDialect- Overrides:
 generateInlinein classJdbcDialectImpl- Parameters:
 columnNames- List of column namescolumnTypes- List of column types ("String" or "Numeric")valueList- List of rows values- Returns:
 - SQL string
 
 
 - 
 
 -