Package mondrian.spi.impl
Class RedshiftDialect
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectImpl
-
- mondrian.spi.impl.PostgreSqlDialect
-
- mondrian.spi.impl.RedshiftDialect
-
- All Implemented Interfaces:
Dialect
public class RedshiftDialect extends PostgreSqlDialect
User: cboyden Date: 2/8/13
-
-
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 JdbcDialectFactory
FACTORY
-
Fields inherited from class mondrian.spi.impl.JdbcDialectImpl
databaseProduct, permitsSelectNotInGroupBy, productVersion
-
-
Constructor Summary
Constructors Constructor Description RedshiftDialect(Connection connection)
Creates a RedshiftDialect.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
generateRegularExpression(String source, String javaRegex)
Must generate a String representing a regular expression match operation between a string literal and a Java regular expression.Dialect.DatabaseProduct
getDatabaseProduct()
Returns the database for this Dialect, orDialect.DatabaseProduct.UNKNOWN
if the database is not a common database.void
quoteStringLiteral(StringBuilder buf, String value)
Appends to a buffer a single-quoted SQL string.-
Methods inherited from class mondrian.spi.impl.PostgreSqlDialect
generateOrderByNulls, getType, requiresAliasForFromQuery
-
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
allowsAs, allowsCompoundCountDistinct, allowsCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsOrderByAlias, allowsSelectNotInGroupBy, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNullsAnsi, generateOrderItem, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, getStatisticsProviders, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsMultiValueInExpr, supportsResultSetConcurrency, supportsUnlimitedValueList, toString, toUpper
-
-
-
-
Field Detail
-
FACTORY
public static final JdbcDialectFactory FACTORY
-
-
Constructor Detail
-
RedshiftDialect
public RedshiftDialect(Connection connection) throws SQLException
Creates a RedshiftDialect.- Parameters:
connection
- Connection- Throws:
SQLException
-
-
Method Detail
-
getDatabaseProduct
public Dialect.DatabaseProduct getDatabaseProduct()
Description copied from interface:Dialect
Returns the database for this Dialect, orDialect.DatabaseProduct.UNKNOWN
if the database is not a common database.- Specified by:
getDatabaseProduct
in interfaceDialect
- Overrides:
getDatabaseProduct
in classPostgreSqlDialect
- Returns:
- Database
-
generateInline
public String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
Description copied from interface:Dialect
Generates 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:
generateInline
in interfaceDialect
- Overrides:
generateInline
in classJdbcDialectImpl
- Parameters:
columnNames
- List of column namescolumnTypes
- List of column types ("String" or "Numeric")valueList
- List of rows values- Returns:
- SQL string
-
quoteStringLiteral
public void quoteStringLiteral(StringBuilder buf, String value)
Description copied from interface:Dialect
Appends to a buffer a single-quoted SQL string.For example, in the default dialect,
quoteStringLiteral(buf, "Can't")
appends "'Can''t'
" tobuf
.- Specified by:
quoteStringLiteral
in interfaceDialect
- Overrides:
quoteStringLiteral
in classJdbcDialectImpl
- Parameters:
buf
- Buffer to append tovalue
- Literal
-
allowsRegularExpressionInWhereClause
public boolean allowsRegularExpressionInWhereClause()
Description copied from interface:Dialect
Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.- Specified by:
allowsRegularExpressionInWhereClause
in interfaceDialect
- Overrides:
allowsRegularExpressionInWhereClause
in classPostgreSqlDialect
- Returns:
- True if regular expressions are supported.
-
generateRegularExpression
public String generateRegularExpression(String source, String javaRegex)
Description copied from interface:Dialect
Must 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:
generateRegularExpression
in interfaceDialect
- Overrides:
generateRegularExpression
in classPostgreSqlDialect
- 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.
-
-