Package mondrian.spi.impl
Class JdbcDialectFactory
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectFactory
-
- All Implemented Interfaces:
DialectFactory
public class JdbcDialectFactory extends Object implements DialectFactory
Implementation ofDialectFactory
for subclasses ofJdbcDialectImpl
.Assumes that the dialect has a public constructor that takes a
Connection
as a parameter.
-
-
Constructor Summary
Constructors Constructor Description JdbcDialectFactory(Class<? extends JdbcDialectImpl> dialectClass, Dialect.DatabaseProduct databaseProduct)
Creates a JdbcDialectFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
acceptsConnection(Connection connection)
Returns whether this dialect is suitable for the given connection.Dialect
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 Detail
-
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 Detail
-
createDialectHelper
public static Dialect createDialectHelper(DialectFactory factory, DataSource dataSource)
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
public Dialect createDialect(DataSource dataSource, Connection connection)
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
protected boolean acceptsConnection(Connection connection)
Returns whether this dialect is suitable for the given connection.- Parameters:
connection
- Connection- Returns:
- Whether suitable
-
-