public class SnowflakeDialect extends JdbcDialectImpl
Dialect.DatabaseProduct, Dialect.Datatype| Modifier and Type | Field and Description |
|---|---|
static JdbcDialectFactory |
FACTORY |
databaseProduct, permitsSelectNotInGroupBy, productVersion| Constructor and Description |
|---|
SnowflakeDialect(Connection connection) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsOrderByAlias()
Returns true if aliases defined in the SELECT clause can be used as
expressions in the ORDER BY clause.
|
boolean |
allowsRegularExpressionInWhereClause()
Informs Mondrian if the dialect supports regular expressions
when creating the 'where' or the 'having' clause.
|
boolean |
allowsSelectNotInGroupBy()
Returns whether the database currently permits queries to include in the
SELECT clause expressions that are not listed in the GROUP BY 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.
|
String |
getQuoteIdentifierString()
Returns the character which is used to quote identifiers, or null
if quoting is not supported.
|
SqlStatement.Type |
getType(ResultSetMetaData metaData,
int columnIndex)
Chooses the most appropriate type for accessing the values of a
column in a result set for a dialect.
|
void |
quoteStringLiteral(StringBuilder buf,
String s)
Appends to a buffer a single-quoted SQL string.
|
allowsAs, allowsCompoundCountDistinct, allowsCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNulls, generateOrderByNullsAnsi, generateOrderItem, getDatabaseProduct, getMaxColumnNameLength, getProduct, getStatisticsProviders, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresAliasForFromQuery, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsMultiValueInExpr, supportsResultSetConcurrency, supportsUnlimitedValueList, toString, toUpperpublic static final JdbcDialectFactory FACTORY
public SnowflakeDialect(Connection connection) throws SQLException
SQLExceptionpublic String getQuoteIdentifierString()
DialectgetQuoteIdentifierString in interface DialectgetQuoteIdentifierString 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 void quoteStringLiteral(StringBuilder buf, String s)
DialectFor example, in the default dialect,
quoteStringLiteral(buf, "Can't") appends
"'Can''t'" to buf.
quoteStringLiteral in interface DialectquoteStringLiteral in class JdbcDialectImplbuf - Buffer to append tos - Literalpublic boolean allowsOrderByAlias()
DialectFor example, in such a dialect,
SELECT x, x + y AS z FROM t ORDER BY z
would be legal.
MySQL, DB2 and Ingres are examples of dialects where this is true; Access is a dialect where this is false.
allowsOrderByAlias in interface DialectallowsOrderByAlias in class JdbcDialectImplpublic boolean allowsSelectNotInGroupBy()
DialectFor example, SELECT empno, first_name || ' ' || last_name FROM
emps GROUP BY empno is valid because empno is the primary key of
the emps table, and therefore all columns are dependent on it.
For a given value of empno,
first_name || ' ' || last_name has a unique value.
Most databases do not, MySQL is an example of one that does (if the functioality is enabled).
allowsSelectNotInGroupBy in interface DialectallowsSelectNotInGroupBy in class JdbcDialectImplpublic boolean allowsRegularExpressionInWhereClause()
DialectallowsRegularExpressionInWhereClause in interface DialectallowsRegularExpressionInWhereClause in class JdbcDialectImplpublic SqlStatement.Type getType(ResultSetMetaData metaData, int columnIndex) throws SQLException
DialectChooses the most appropriate type for accessing the values of a column in a result set for a dialect.
Dialect-specific nuances involving type representation should be encapsulated in implementing methods. For example, if a dialect has implicit rules involving scale or precision, they should be handled within this method so the client can simply retrieve the "best fit" SqlStatement.Type for the column.
getType in interface DialectgetType in class JdbcDialectImplmetaData - Results set metadatacolumnIndex - Column ordinal (0-based)SQLExceptionpublic 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.Copyright © 2021 Hitachi Vantara. All rights reserved.