|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmondrian.spi.impl.JdbcDialectImpl
mondrian.spi.impl.AccessDialect
public class AccessDialect
Implementation of Dialect
for the Microsoft Access
database (also called the JET Engine).
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 | |
---|---|
AccessDialect(Connection connection)
Creates an AccessDialect. |
Method Summary | |
---|---|
boolean |
allowsCountDistinct()
Returns whether this Dialect supports distinct aggregations. |
String |
caseWhenElse(String cond,
String thenExpr,
String elseExpr)
Generates a conditional statement in this dialect's syntax. |
String |
generateInline(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList)
Generates a SQL statement to represent an inline dataset. |
String |
generateOrderItem(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.NullCollation |
getNullCollation()
Returns the rule which determines whether NULL values appear first or last when sorted using ORDER BY. |
protected void |
quoteDateLiteral(StringBuilder buf,
String value,
Date date)
Helper method for JdbcDialectImpl.quoteDateLiteral(StringBuilder, String) . |
boolean |
requiresUnionOrderByExprToBeInSelectClause()
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. |
String |
toUpper(String expr)
Converts an expression to upper case. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final JdbcDialectFactory FACTORY
Constructor Detail |
---|
public AccessDialect(Connection connection) throws SQLException
connection
- Connection
SQLException
Method Detail |
---|
public String toUpper(String expr)
Dialect
For example, for MySQL, toUpper("foo.bar")
returns
"UPPER(foo.bar)"
.
toUpper
in interface Dialect
toUpper
in class JdbcDialectImpl
expr
- SQL expression
expr
into upper case.public String caseWhenElse(String cond, String thenExpr, String elseExpr)
Dialect
For example, caseWhenElse("b", "1", "0")
returns
"case when b then 1 else 0 end"
on Oracle,
"Iif(b, 1, 0)"
on Access.
caseWhenElse
in interface Dialect
caseWhenElse
in class JdbcDialectImpl
cond
- Predicate expressionthenExpr
- Expression if condition is trueelseExpr
- Expression if condition is false
protected void quoteDateLiteral(StringBuilder buf, String value, Date date)
JdbcDialectImpl
JdbcDialectImpl.quoteDateLiteral(StringBuilder, String)
.
quoteDateLiteral
in class JdbcDialectImpl
buf
- Buffer to append tovalue
- Value as stringdate
- Value as datepublic Dialect.NullCollation getNullCollation()
Dialect
According to the SQL standard, this is implementation-specific.
The default behavior is
Dialect.NullCollation.POSINF
.
getNullCollation
in interface Dialect
getNullCollation
in class JdbcDialectImpl
public String generateOrderItem(String expr, boolean nullable, boolean ascending)
Dialect
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".
generateOrderItem
in interface Dialect
generateOrderItem
in class JdbcDialectImpl
expr
- Expressionnullable
- Whether expression may have NULL valuesascending
- Whether to sort expression ascending
public boolean requiresUnionOrderByExprToBeInSelectClause()
Dialect
For example,
SELECT x, y + z FROM t
is 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 + z
is not.
Access is an example of a dialect with this restriction.
requiresUnionOrderByExprToBeInSelectClause
in interface Dialect
requiresUnionOrderByExprToBeInSelectClause
in class JdbcDialectImpl
public boolean allowsCountDistinct()
Dialect
For example, Access does not allow
select count(distinct x) from t
allowsCountDistinct
in interface Dialect
allowsCountDistinct
in class JdbcDialectImpl
public String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
Dialect
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')
generateInline
in interface Dialect
generateInline
in class JdbcDialectImpl
columnNames
- List of column namescolumnTypes
- List of column types ("String" or "Numeric")valueList
- List of rows values
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |