public class JdbcDialectImpl extends Object implements Dialect
Dialect based on a JDBC connection and metadata.
If you are writing a class for a specific database dialect, we recommend
that you use this as a base class, so your dialect class will be
forwards-compatible. If methods are added to Dialect in future
revisions, default implementations of those methods will be added to this
class.
Mondrian uses JdbcDialectImpl as a fallback if it cannot find a more specific dialect. JdbcDialectImpl reads properties from the JDBC driver's metadata, so can deduce some of the dialect's behavior.
Dialect.DatabaseProduct, Dialect.Datatype| Modifier and Type | Field and Description |
|---|---|
protected Dialect.DatabaseProduct |
databaseProduct
Major database product (or null if product is not a common one)
|
protected boolean |
permitsSelectNotInGroupBy
Indicates whether the database allows selection of columns
not listed in the group by clause.
|
protected String |
productVersion
Product version per JDBC driver.
|
| Constructor and Description |
|---|
JdbcDialectImpl() |
JdbcDialectImpl(Connection connection)
Creates a JdbcDialectImpl.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsAs()
Returns whether the SQL dialect allows "AS" in the FROM clause.
|
boolean |
allowsCompoundCountDistinct()
Returns whether this Dialect allows multiple arguments to the
COUNT(DISTINCT ...) aggregate function, for example
|
boolean |
allowsCountDistinct()
Returns whether this Dialect supports distinct aggregations.
|
boolean |
allowsDdl()
Returns whether this dialect supports common SQL Data Definition
Language (DDL) statements such as
CREATE TABLE and
DROP INDEX. |
boolean |
allowsDialectSharing()
Returns whether this Dialect object can be used for all connections
from the same data source.
|
boolean |
allowsFromQuery()
Returns whether this Dialect allows a subquery in the from clause,
for example
SELECT * FROM (SELECT * FROM t) AS
x |
boolean |
allowsJoinOn()
Returns whether this dialect supports "ANSI-style JOIN syntax",
FROM leftTable JOIN rightTable ON conditon. |
boolean |
allowsMultipleCountDistinct()
Returns whether this Dialect supports more than one distinct
aggregation in the same query.
|
boolean |
allowsMultipleDistinctSqlMeasures()
Returns whether this Dialect has performant support of distinct SQL
measures in the same query.
|
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.
|
void |
appendHintsAfterFromClause(StringBuilder buf,
Map<String,String> hints)
Assembles and returns a string containing any hints that should
be appended after the FROM clause in a SELECT statement, based
on any hints provided.
|
String |
caseWhenElse(String cond,
String thenExpr,
String elseExpr)
Generates a conditional statement in this dialect's syntax.
|
protected List<StatisticsProvider> |
computeStatisticsProviders() |
protected String |
deduceIdentifierQuoteString(DatabaseMetaData databaseMetaData) |
protected int |
deduceMaxColumnNameLength(DatabaseMetaData databaseMetaData) |
protected String |
deduceProductName(DatabaseMetaData databaseMetaData) |
protected String |
deduceProductVersion(DatabaseMetaData databaseMetaData) |
protected boolean |
deduceReadOnly(DatabaseMetaData databaseMetaData) |
protected Set<List<Integer>> |
deduceSupportedResultSetStyles(DatabaseMetaData databaseMetaData) |
protected boolean |
deduceSupportsSelectNotInGroupBy(Connection conn)
Detects whether the database is configured to permit queries
that include columns in the SELECT that are not also in the GROUP BY.
|
String |
generateCountExpression(String exp)
Some databases, like Greenplum, don't include nulls as part
of the results of a COUNT sql call.
|
String |
generateInline(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList)
Generates a SQL statement to represent an inline dataset.
|
String |
generateInlineForAnsi(String alias,
List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList,
boolean cast)
Generates inline values list using ANSI 'VALUES' syntax.
|
protected String |
generateInlineGeneric(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList,
String fromClause,
boolean cast)
Generic algorithm to generate inline values list,
using an optional FROM clause, specified by the caller of this
method, appropriate to the dialect of SQL.
|
protected String |
generateOrderByNulls(String expr,
boolean ascending,
boolean collateNullsLast)
Generates SQL to force null values to collate last.
|
protected String |
generateOrderByNullsAnsi(String expr,
boolean ascending,
boolean collateNullsLast)
Implementation for the
generateOrderByNulls(java.lang.String, boolean, boolean) method
that uses the ANSI syntax "expr direction NULLS LAST"
and "expr direction NULLS FIRST". |
String |
generateOrderItem(String expr,
boolean nullable,
boolean ascending,
boolean collateNullsLast)
Generates an item for an ORDER BY clause, sorting in the required
direction, and ensuring that NULL values collate either before or after
all non-NULL values, depending on the
collateNullsLast
parameter. |
String |
generateRegularExpression(String source,
String javaRegExp)
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, or
Dialect.DatabaseProduct.UNKNOWN if the database is
not a common database. |
int |
getMaxColumnNameLength()
Returns the maximum length of the name of a database column or query
alias allowed by this dialect.
|
static Dialect.DatabaseProduct |
getProduct(String productName,
String productVersion)
Converts a product name and version (per the JDBC driver) into a product
enumeration.
|
String |
getQuoteIdentifierString()
Returns the character which is used to quote identifiers, or null
if quoting is not supported.
|
List<StatisticsProvider> |
getStatisticsProviders()
Returns a list of statistics providers for this dialect.
|
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.
|
protected static boolean |
isDatabase(Dialect.DatabaseProduct databaseProduct,
Connection connection)
Helper method to determine if a connection would work with
a given database product.
|
(package private) void |
logTypeInfo(ResultSetMetaData metaData,
int columnIndex,
SqlStatement.Type internalType) |
boolean |
needsExponent(Object value,
String valueString)
If Double values need to include additional exponent in its string
represenation.
|
void |
quote(StringBuilder buf,
Object value,
Dialect.Datatype datatype)
Appends to a buffer a value quoted for its type.
|
void |
quoteBooleanLiteral(StringBuilder buf,
String value)
Appends to a buffer a boolean literal.
|
void |
quoteDateLiteral(StringBuilder buf,
String value)
Appends to a buffer a date literal.
|
protected void |
quoteDateLiteral(StringBuilder buf,
String value,
Date date)
Helper method for
quoteDateLiteral(StringBuilder, String). |
String |
quoteIdentifier(String val)
Encloses an identifier in quotation marks appropriate for this
Dialect.
|
void |
quoteIdentifier(StringBuilder buf,
String... names)
Appends to a buffer a list of identifiers, quoted
appropriately for this Dialect.
|
String |
quoteIdentifier(String qual,
String name)
Encloses an identifier in quotation marks appropriate for the
current SQL dialect.
|
void |
quoteIdentifier(String val,
StringBuilder buf)
Appends to a buffer an identifier, quoted appropriately for this
Dialect.
|
void |
quoteNumericLiteral(StringBuilder buf,
String value)
Appends to a buffer a numeric literal.
|
void |
quoteStringLiteral(StringBuilder buf,
String s)
Appends to a buffer a single-quoted SQL string.
|
void |
quoteTimeLiteral(StringBuilder buf,
String value)
Appends to a buffer a time literal.
|
void |
quoteTimestampLiteral(StringBuilder buf,
String value)
Appends to a buffer a timestamp literal.
|
boolean |
requiresAliasForFromQuery()
Returns whether this Dialect requires subqueries in the FROM clause
to have an alias.
|
boolean |
requiresGroupByAlias()
Returns true if this Dialect can include expressions in the GROUP BY
clause only by adding an expression to the SELECT clause and using
its alias.
|
boolean |
requiresHavingAlias()
Returns true if this Dialect can include expressions in the HAVING
clause only by adding an expression to the SELECT clause and using
its alias.
|
boolean |
requiresOrderByAlias()
Returns true if this Dialect can include expressions in the ORDER BY
clause only by adding an expression to the SELECT clause and using
its alias.
|
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.
|
boolean |
requiresUnionOrderByOrdinal()
Returns true if this dialect allows only integers in the ORDER BY
clause of a UNION (or other set operation) query.
|
boolean |
supportsGroupByExpressions()
Returns whether this Dialect supports expressions in the GROUP BY
clause.
|
boolean |
supportsGroupingSets()
Returns whether this Dialect allows the GROUPING SETS construct in
the GROUP BY clause.
|
boolean |
supportsMultiValueInExpr()
Returns true if this dialect supports multi-value IN expressions.
|
boolean |
supportsResultSetConcurrency(int type,
int concurrency)
Returns whether this Dialect supports the given concurrency type
in combination with the given result set type.
|
boolean |
supportsUnlimitedValueList()
Returns whether this Dialect places no limit on the number
of rows which can appear as elements of an IN or VALUES
expression.
|
String |
toString() |
String |
toUpper(String expr)
Converts an expression to upper case.
|
protected final String productVersion
protected boolean permitsSelectNotInGroupBy
protected final Dialect.DatabaseProduct databaseProduct
public JdbcDialectImpl(Connection connection) throws SQLException
To prevent connection leaks, this constructor does not hold a reference to the connection after the call returns. It makes a copy of everything useful during the call. Derived classes must do the same.
SQLException - on errorconnection - Connectionpublic JdbcDialectImpl()
public Dialect.DatabaseProduct getDatabaseProduct()
DialectDialect.DatabaseProduct.UNKNOWN if the database is
not a common database.getDatabaseProduct in interface Dialectpublic void appendHintsAfterFromClause(StringBuilder buf, Map<String,String> hints)
DialectappendHintsAfterFromClause in interface Dialectbuf - The Stringbuffer to which the dialect-specific syntax
for any relevant table hints may be appended. Must not be null.hints - A map of table hints provided in the schema definitionpublic boolean allowsDialectSharing()
DialectThe default implementation returns true, and this allows
dialects to be cached and reused in environments where connections are
allocated from a pool based on the same data source.
Data sources are deemed 'equal' by the same criteria used by Java
collections, namely the Object.equals(Object) and
Object.hashCode() methods.
allowsDialectSharing in interface DialectDialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection)protected int deduceMaxColumnNameLength(DatabaseMetaData databaseMetaData)
protected boolean deduceReadOnly(DatabaseMetaData databaseMetaData)
protected String deduceProductName(DatabaseMetaData databaseMetaData)
protected String deduceIdentifierQuoteString(DatabaseMetaData databaseMetaData)
protected String deduceProductVersion(DatabaseMetaData databaseMetaData)
protected Set<List<Integer>> deduceSupportedResultSetStyles(DatabaseMetaData databaseMetaData)
protected boolean deduceSupportsSelectNotInGroupBy(Connection conn) throws SQLException
Detects whether the database is configured to permit queries that include columns in the SELECT that are not also in the GROUP BY. MySQL is an example of one that does, though this is configurable.
The expectation is that this will not change while Mondrian is running, though some databases (MySQL) allow changing it on the fly.
SQLException - on errorconn - The database connectionpublic String toUpper(String expr)
DialectFor example, for MySQL, toUpper("foo.bar") returns
"UPPER(foo.bar)".
public String caseWhenElse(String cond, String thenExpr, String elseExpr)
DialectFor 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 Dialectcond - Predicate expressionthenExpr - Expression if condition is trueelseExpr - Expression if condition is falsepublic String quoteIdentifier(String val)
DialectFor example,
quoteIdentifier("emp") yields a string containing
"emp" in Oracle, and a string containing
[emp] in Access.
quoteIdentifier in interface Dialectval - Identifierpublic void quoteIdentifier(String val, StringBuilder buf)
DialectquoteIdentifier in interface Dialectval - identifier to quote (must not be null).buf - Bufferpublic String quoteIdentifier(String qual, String name)
DialectquoteIdentifier("schema","table") yields a string
containing "schema"."table".quoteIdentifier in interface Dialectqual - Qualifier. If it is not null,
"qual". is prepended.name - Name to be quoted.public void quoteIdentifier(StringBuilder buf, String... names)
DialectNames in the list may be null, but there must be at least one non-null name in the list.
quoteIdentifier in interface Dialectbuf - Buffernames - List of names to be quotedpublic String getQuoteIdentifierString()
DialectgetQuoteIdentifierString in interface Dialectpublic void quoteStringLiteral(StringBuilder buf, String s)
DialectFor example, in the default dialect,
quoteStringLiteral(buf, "Can't") appends
"'Can''t'" to buf.
quoteStringLiteral in interface Dialectbuf - Buffer to append tos - Literalpublic void quoteNumericLiteral(StringBuilder buf, String value)
DialectIn the default dialect, numeric literals are printed as is.
quoteNumericLiteral in interface Dialectbuf - Buffer to append tovalue - Literalpublic void quoteBooleanLiteral(StringBuilder buf, String value)
DialectIn the default dialect, boolean literals are printed as is.
quoteBooleanLiteral in interface Dialectbuf - Buffer to append tovalue - Literalpublic void quoteDateLiteral(StringBuilder buf, String value)
DialectFor example, in the default dialect,
quoteStringLiteral(buf, "1969-03-17")
appends DATE '1969-03-17'.
quoteDateLiteral in interface Dialectbuf - Buffer to append tovalue - Literalprotected void quoteDateLiteral(StringBuilder buf, String value, Date date)
quoteDateLiteral(StringBuilder, String).buf - Buffer to append tovalue - Value as stringdate - Value as datepublic void quoteTimeLiteral(StringBuilder buf, String value)
DialectFor example, in the default dialect,
quoteStringLiteral(buf, "12:34:56")
appends TIME '12:34:56'.
quoteTimeLiteral in interface Dialectbuf - Buffer to append tovalue - Literalpublic void quoteTimestampLiteral(StringBuilder buf, String value)
DialectFor example, in the default dialect,
quoteStringLiteral(buf, "1969-03-17 12:34:56")
appends TIMESTAMP '1969-03-17 12:34:56'.
quoteTimestampLiteral in interface Dialectbuf - Buffer to append tovalue - Literalpublic boolean requiresAliasForFromQuery()
DialectrequiresAliasForFromQuery in interface DialectDialect.allowsFromQuery()public boolean allowsAs()
Dialectpublic boolean allowsFromQuery()
DialectSELECT * FROM (SELECT * FROM t) AS
xallowsFromQuery in interface DialectDialect.requiresAliasForFromQuery()public boolean allowsCompoundCountDistinct()
DialectCOUNT(DISTINCT ...) aggregate function, for example
SELECT COUNT(DISTINCT x, y) FROM t
allowsCompoundCountDistinct in interface DialectDialect.allowsCountDistinct(),
Dialect.allowsMultipleCountDistinct()public boolean allowsCountDistinct()
DialectFor example, Access does not allow
select count(distinct x) from t
allowsCountDistinct in interface Dialectpublic boolean allowsMultipleCountDistinct()
DialectIn Derby 10.1,
select couunt(distinct x) from t
is OK, but
select couunt(distinct x), count(distinct y) from t
gives "Multiple DISTINCT aggregates are not supported at this time."allowsMultipleCountDistinct in interface Dialectpublic boolean allowsMultipleDistinctSqlMeasures()
DialectallowsMultipleDistinctSqlMeasures in interface Dialectpublic 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 DialectcolumnNames - List of column namescolumnTypes - List of column types ("String" or "Numeric")valueList - List of rows valuesprotected String generateInlineGeneric(List<String> columnNames, List<String> columnTypes, List<String[]> valueList, String fromClause, boolean cast)
columnNames - Column namescolumnTypes - Column typesvalueList - List rowsfromClause - FROM clause, or nullcast - Whether to cast the values in the first rowpublic String generateInlineForAnsi(String alias, List<String> columnNames, List<String> columnTypes, List<String[]> valueList, boolean cast)
SELECT * FROM
(VALUES (1, 'a'), (2, 'b')) AS t(x, y)
If NULL values are present, we use a CAST to ensure that they have the same type as other columns:
SELECT * FROM
(VALUES (1, 'a'), (2, CASE(NULL AS VARCHAR(1)))) AS t(x, y)
This syntax is known to work on Derby, but not Oracle 10 or Access.
alias - Table aliascolumnNames - Column namescolumnTypes - Column typesvalueList - List rowscast - Whether to generate castspublic boolean needsExponent(Object value, String valueString)
DialectneedsExponent in interface Dialectvalue - Double value to generate string forvalueString - java string representation for this value.public void quote(StringBuilder buf, Object value, Dialect.Datatype datatype)
Dialectpublic boolean allowsDdl()
DialectCREATE TABLE and
DROP INDEX.
Access seems to allow DDL iff the .mdb file is writeable.
allowsDdl in interface DialectDatabaseMetaData.isReadOnly()public String generateOrderItem(String expr, boolean nullable, boolean ascending, boolean collateNullsLast)
DialectcollateNullsLast
parameter.generateOrderItem in interface Dialectexpr - Expressionnullable - Whether expression may have NULL valuesascending - Whether to sort expression ascendingcollateNullsLast - Whether the null values should be sorted first
or last.protected String generateOrderByNulls(String expr, boolean ascending, boolean collateNullsLast)
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
generateOrderByNullsAnsi(java.lang.String, boolean, boolean).
This method is only called from
generateOrderItem(String, boolean, boolean, boolean).
Some dialects override that method and therefore never call
this method.
expr - Expression.ascending - Whether ascending.collateNullsLast - Whether nulls should appear first or last.protected final String generateOrderByNullsAnsi(String expr, boolean ascending, boolean collateNullsLast)
generateOrderByNulls(java.lang.String, boolean, boolean) method
that uses the ANSI syntax "expr direction NULLS LAST"
and "expr direction NULLS FIRST".expr - Expressionascending - Whether ascendingcollateNullsLast - Whether nulls should appear first or last.public boolean supportsGroupByExpressions()
DialectsupportsGroupByExpressions in interface Dialectpublic 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 Dialectpublic boolean allowsJoinOn()
DialectFROM leftTable JOIN rightTable ON conditon.allowsJoinOn in interface Dialectpublic boolean supportsGroupingSets()
DialectsupportsGroupingSets in interface Dialectpublic boolean supportsUnlimitedValueList()
DialectsupportsUnlimitedValueList in interface Dialectpublic boolean requiresGroupByAlias()
DialectFor example, in such a dialect,
SELECT x, x FROM t GROUP BY x
would be illegal, but
SELECT x AS a, x AS b FROM t ORDER BY a, b
would be legal.
Infobright is the only such dialect.
requiresGroupByAlias in interface Dialectpublic boolean requiresOrderByAlias()
DialectFor example, in such a dialect,
SELECT x FROM t ORDER BY x + y
would be illegal, but
SELECT x, x + y AS z FROM t ORDER BY z
would be legal.
MySQL, DB2 and Ingres are examples of such dialects.
requiresOrderByAlias in interface Dialectpublic boolean requiresHavingAlias()
DialectFor example, in such a dialect,
SELECT CONCAT(x) as foo FROM t HAVING CONCAT(x) LIKE "%"
would be illegal, but
SELECT CONCAT(x) as foo FROM t HAVING foo LIKE "%"
would be legal.
MySQL is an example of such dialects.
requiresHavingAlias in interface Dialectpublic 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 Dialectpublic boolean requiresUnionOrderByOrdinal()
DialectFor example,
SELECT x, y + z FROM t
is allowed but
UNION ALL
SELECT x, y + z FROM t
ORDER BY 1, 2SELECT x, y, z FROM t
is not.
UNION ALL
SELECT x, y, z FROM t
ORDER BY x
Teradata is an example of a dialect with this restriction.
requiresUnionOrderByOrdinal in interface Dialectpublic boolean requiresUnionOrderByExprToBeInSelectClause()
DialectFor 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 Dialectpublic boolean supportsMultiValueInExpr()
DialectWHERE (col1, col2) IN ((val1a, val2a), (val1b, val2b))supportsMultiValueInExpr in interface Dialectpublic boolean supportsResultSetConcurrency(int type, int concurrency)
DialectThe result is similar to
DatabaseMetaData.supportsResultSetConcurrency(int, int),
except that the JdbcOdbc bridge in JDK 1.6 overstates its abilities.
See bug 1690406.
supportsResultSetConcurrency in interface Dialecttype - defined in ResultSetconcurrency - type defined in ResultSettrue if so; false otherwisepublic int getMaxColumnNameLength()
DialectgetMaxColumnNameLength in interface DialectDatabaseMetaData.getMaxColumnNameLength()public boolean allowsRegularExpressionInWhereClause()
DialectallowsRegularExpressionInWhereClause in interface Dialectpublic String generateCountExpression(String exp)
DialectgenerateCountExpression in interface Dialectexp - The expression to wrap.public String generateRegularExpression(String source, String javaRegExp)
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 Dialectsource - A String identifying the column to match against.javaRegExp - A Java regular expression to match against.public List<StatisticsProvider> getStatisticsProviders()
DialectThe default implementation looks for the value of the property
mondrian.statistics.providers.PRODUCT where product is the
current dialect's product name (for example "MYSQL"). If that property
has no value, looks at the property
mondrian.statistics.providers. The property value should be
a comma-separated list of names of classes that implement the
StatisticsProvider interface. For each statistic required,
Mondrian will call the method each statistics provider in turn, until one
of them returns a non-negative value.
getStatisticsProviders in interface Dialectpublic 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 DialectSQLExceptionmetaData - Results set metadatacolumnIndex - Column ordinal (0-based)void logTypeInfo(ResultSetMetaData metaData, int columnIndex, SqlStatement.Type internalType) throws SQLException
SQLExceptionprotected List<StatisticsProvider> computeStatisticsProviders()
public static Dialect.DatabaseProduct getProduct(String productName, String productVersion)
productName - Product nameproductVersion - Product versionprotected static boolean isDatabase(Dialect.DatabaseProduct databaseProduct, Connection connection)
It will first try to use
DatabaseMetaData.getDatabaseProductName() and match the
name of Dialect.DatabaseProduct passed as an argument.
If that fails, it will try to execute select version();
and obtains some information directly from the server.
databaseProduct - Database product instanceconnection - SQL connection