public class OracleDialect extends JdbcDialectImpl
Dialect for the Oracle database.Dialect.DatabaseProduct, Dialect.Datatype| Modifier and Type | Field and Description |
|---|---|
static JdbcDialectFactory |
FACTORY |
databaseProduct, permitsSelectNotInGroupBy, productVersion| Constructor and Description |
|---|
OracleDialect() |
OracleDialect(Connection connection)
Creates an OracleDialect.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsAs()
Returns whether the SQL dialect allows "AS" in the FROM clause.
|
boolean |
allowsJoinOn()
Returns whether this dialect supports "ANSI-style JOIN syntax",
FROM leftTable JOIN rightTable ON conditon. |
boolean |
allowsRegularExpressionInWhereClause()
Informs Mondrian if the dialect supports regular expressions
when creating the 'where' or the 'having' clause.
|
String |
generateInline(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList)
Generates a SQL statement to represent an inline dataset.
|
String |
generateOrderByNulls(String expr,
boolean ascending,
boolean collateNullsLast)
Generates SQL to force null values to collate last.
|
String |
generateRegularExpression(String source,
String javaRegex)
Must generate a String representing a regular expression match
operation between a string literal and a Java regular expression.
|
SqlStatement.Type |
getType(ResultSetMetaData metaData,
int columnIndex)
Chooses the most appropriate type for accessing the values of a
column in a result set.
|
boolean |
supportsGroupingSets()
Returns whether this Dialect allows the GROUPING SETS construct in
the GROUP BY clause.
|
allowsCompoundCountDistinct, allowsCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsOrderByAlias, allowsSelectNotInGroupBy, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNullsAnsi, generateOrderItem, getDatabaseProduct, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, getStatisticsProviders, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteStringLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresAliasForFromQuery, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsMultiValueInExpr, supportsResultSetConcurrency, supportsUnlimitedValueList, toString, toUpperpublic static final JdbcDialectFactory FACTORY
public OracleDialect(Connection connection) throws SQLException
connection - ConnectionSQLExceptionpublic OracleDialect()
public boolean allowsAs()
DialectallowsAs in interface DialectallowsAs in class JdbcDialectImplpublic String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
DialectFor 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 DialectgenerateInline in class JdbcDialectImplcolumnNames - List of column namescolumnTypes - List of column types ("String" or "Numeric")valueList - List of rows valuespublic boolean supportsGroupingSets()
DialectsupportsGroupingSets in interface DialectsupportsGroupingSets in class JdbcDialectImplpublic String generateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)
JdbcDialectImplThis 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 JdbcDialectImplexpr - Expression.ascending - Whether ascending.collateNullsLast - Whether nulls should appear first or last.public boolean allowsJoinOn()
DialectFROM leftTable JOIN rightTable ON conditon.allowsJoinOn in interface DialectallowsJoinOn in class JdbcDialectImplpublic boolean allowsRegularExpressionInWhereClause()
DialectallowsRegularExpressionInWhereClause in interface DialectallowsRegularExpressionInWhereClause in class JdbcDialectImplpublic String generateRegularExpression(String source, String javaRegex)
DialectPostgres / Greenplum example:
generateRegularExpression(
"'foodmart'.'customer_name'", "(?i).*oo.*") ->
'foodmart'.'customer_name' ~ "(?i).*oo.*"
Oracle example:
generateRegularExpression(
"'foodmart'.'customer_name'", ".*oo.*") ->
REGEXP_LIKE('foodmart'.'customer_name', ".*oo.*")
Dialects are allowed to return null if the dialect cannot convert that particular regular expression into something that the database would support.
generateRegularExpression in interface DialectgenerateRegularExpression in class JdbcDialectImplsource - A String identifying the column to match against.javaRegex - A Java regular expression to match against.public SqlStatement.Type getType(ResultSetMetaData metaData, int columnIndex) throws SQLException
getType in interface DialectgetType in class JdbcDialectImplmetaData - Resultset metadatacolumnIndex - index of the column in the result setSQLExceptionCopyright © 2021 Hitachi Vantara. All rights reserved.