public class AccessDialect extends JdbcDialectImpl
Dialect
for the Microsoft Access
database (also called the JET Engine).Dialect.DatabaseProduct, Dialect.Datatype
Modifier and Type | Field and Description |
---|---|
static JdbcDialectFactory |
FACTORY |
databaseProduct, permitsSelectNotInGroupBy, productVersion
Constructor and Description |
---|
AccessDialect(Connection connection)
Creates an AccessDialect.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected String |
generateOrderByNulls(String expr,
boolean ascending,
boolean collateNullsLast)
Generates SQL to force null values to collate last.
|
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.
|
allowsAs, allowsCompoundCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsOrderByAlias, allowsRegularExpressionInWhereClause, allowsSelectNotInGroupBy, appendHintsAfterFromClause, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, 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
public static final JdbcDialectFactory FACTORY
public AccessDialect(Connection connection) throws SQLException
connection
- ConnectionSQLException
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 expressionexpr
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 falseprotected 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 dateprotected String generateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)
JdbcDialectImpl
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 END
You 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.
generateOrderByNulls
in class JdbcDialectImpl
expr
- Expression.ascending
- Whether ascending.collateNullsLast
- Whether nulls should appear first or last.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 valuesCopyright © 2020 Hitachi Vantara. All rights reserved.