Package mondrian.spi.impl
Class JdbcDialectFactory
java.lang.Object
mondrian.spi.impl.JdbcDialectFactory
- All Implemented Interfaces:
DialectFactory
Implementation of
DialectFactory
for subclasses
of JdbcDialectImpl
.
Assumes that the dialect has a public constructor that takes a
Connection
as a parameter.
-
Constructor Summary
ConstructorDescriptionJdbcDialectFactory
(Class<? extends JdbcDialectImpl> dialectClass, Dialect.DatabaseProduct databaseProduct) Creates a JdbcDialectFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptsConnection
(Connection connection) Returns whether this dialect is suitable for the given connection.createDialect
(DataSource dataSource, Connection connection) Creates a Dialect.static Dialect
createDialectHelper
(DialectFactory factory, DataSource dataSource) Creates a temporary connection and callsDialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection)
.
-
Constructor Details
-
JdbcDialectFactory
public JdbcDialectFactory(Class<? extends JdbcDialectImpl> dialectClass, Dialect.DatabaseProduct databaseProduct) Creates a JdbcDialectFactory.- Parameters:
dialectClass
- Dialect classdatabaseProduct
- Database type (e.g. Oracle) if this is a common RDBMS, or null if it is an uncommon one
-
-
Method Details
-
createDialectHelper
Creates a temporary connection and callsDialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection)
.Helper method, called when
createDialect
is called without aConnection
and the dialect factory cannot create a dialect withDataSource
alone.It is a user error if
dataSource
is null (since this implies thatcreateDialect
was called withdataSource
andconnection
both null.- Parameters:
factory
- Dialect factorydataSource
- Data source, must not be null- Returns:
- Dialect, or null if factory cannot create suitable dialect
-
createDialect
Description copied from interface:DialectFactory
Creates a Dialect.If the dialect cannot handle this connection, returns null.
- Specified by:
createDialect
in interfaceDialectFactory
- Parameters:
dataSource
- JDBC data sourceconnection
- JDBC connection- Returns:
- dialect for this connection, or null if this factory's dialect is not appropriate for the connection
-
acceptsConnection
Returns whether this dialect is suitable for the given connection.- Parameters:
connection
- Connection- Returns:
- Whether suitable
-