Class OracleDialect
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectImpl
-
- mondrian.spi.impl.OracleDialect
-
- All Implemented Interfaces:
Dialect
public class OracleDialect extends JdbcDialectImpl
Implementation ofDialectfor the Oracle database.- 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 OracleDialect()OracleDialect(Connection connection)Creates an OracleDialect.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowsAs()Returns whether the SQL dialect allows "AS" in the FROM clause.booleanallowsJoinOn()Returns whether this dialect supports "ANSI-style JOIN syntax",FROM leftTable JOIN rightTable ON conditon.booleanallowsRegularExpressionInWhereClause()Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.StringgenerateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)Generates a SQL statement to represent an inline dataset.StringgenerateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)Generates SQL to force null values to collate last.StringgenerateRegularExpression(String source, String javaRegex)Must generate a String representing a regular expression match operation between a string literal and a Java regular expression.SqlStatement.TypegetType(ResultSetMetaData metaData, int columnIndex)Chooses the most appropriate type for accessing the values of a column in a result set.booleansupportsGroupingSets()Returns whether this Dialect allows the GROUPING SETS construct in the GROUP BY clause.-
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
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, toUpper
-
-
-
-
Field Detail
-
FACTORY
public static final JdbcDialectFactory FACTORY
-
-
Constructor Detail
-
OracleDialect
public OracleDialect(Connection connection) throws SQLException
Creates an OracleDialect.- Parameters:
connection- Connection- Throws:
SQLException
-
OracleDialect
public OracleDialect()
-
-
Method Detail
-
allowsAs
public boolean allowsAs()
Description copied from interface:DialectReturns whether the SQL dialect allows "AS" in the FROM clause. If so, "SELECT * FROM t AS alias" is a valid query.- Specified by:
allowsAsin interfaceDialect- Overrides:
allowsAsin classJdbcDialectImpl- Returns:
- whether dialect allows AS in FROM clause
-
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
-
supportsGroupingSets
public boolean supportsGroupingSets()
Description copied from interface:DialectReturns whether this Dialect allows the GROUPING SETS construct in the GROUP BY clause. Currently Greenplum, IBM DB2, Oracle, and Teradata.- Specified by:
supportsGroupingSetsin interfaceDialect- Overrides:
supportsGroupingSetsin classJdbcDialectImpl- Returns:
- Whether this Dialect allows GROUPING SETS clause
-
generateOrderByNulls
public 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.
-
allowsJoinOn
public boolean allowsJoinOn()
Description copied from interface:DialectReturns whether this dialect supports "ANSI-style JOIN syntax",FROM leftTable JOIN rightTable ON conditon.- Specified by:
allowsJoinOnin interfaceDialect- Overrides:
allowsJoinOnin classJdbcDialectImpl- Returns:
- Whether this dialect supports FROM-JOIN-ON syntax.
-
allowsRegularExpressionInWhereClause
public boolean allowsRegularExpressionInWhereClause()
Description copied from interface:DialectInforms Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.- Specified by:
allowsRegularExpressionInWhereClausein interfaceDialect- Overrides:
allowsRegularExpressionInWhereClausein classJdbcDialectImpl- Returns:
- True if regular expressions are supported.
-
generateRegularExpression
public String generateRegularExpression(String source, String javaRegex)
Description copied from interface:DialectMust generate a String representing a regular expression match operation between a string literal and a Java regular expression. The string literal might be a column identifier or some other identifier, but the implementation must presume that it is already escaped and fit for use. The regular expression is not escaped and must be adapted to the proper dialect rules.Postgres / 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.
- Specified by:
generateRegularExpressionin interfaceDialect- Overrides:
generateRegularExpressionin classJdbcDialectImpl- Parameters:
source- A String identifying the column to match against.javaRegex- A Java regular expression to match against.- Returns:
- A dialect specific matching operation, or null if the dialect cannot convert that particular regular expression into something that the database would support.
-
getType
public SqlStatement.Type getType(ResultSetMetaData metaData, int columnIndex) throws SQLException
Chooses the most appropriate type for accessing the values of a column in a result set. The OracleDialect implementation handles some of the specific quirks of Oracle: e.g. scale = -127 has special meaning with NUMERIC types and may indicate a FLOAT value if precision is non-zero.- Specified by:
getTypein interfaceDialect- Overrides:
getTypein classJdbcDialectImpl- Parameters:
metaData- Resultset metadatacolumnIndex- index of the column in the result set- Returns:
- For Types.NUMERIC and Types.DECIMAL, getType() will return a Type.INT, Type.DOUBLE, or Type.OBJECT based on scale, precision, and column name.
- Throws:
SQLException
-
-