Class JdbcDialectFactory

java.lang.Object
mondrian.spi.impl.JdbcDialectFactory
All Implemented Interfaces:
DialectFactory

public class JdbcDialectFactory extends Object implements DialectFactory
Implementation of DialectFactory for subclasses of JdbcDialectImpl.

Assumes that the dialect has a public constructor that takes a Connection as a parameter.

  • Constructor Details

    • JdbcDialectFactory

      public JdbcDialectFactory(Class<? extends JdbcDialectImpl> dialectClass, Dialect.DatabaseProduct databaseProduct)
      Creates a JdbcDialectFactory.
      Parameters:
      dialectClass - Dialect class
      databaseProduct - Database type (e.g. Oracle) if this is a common RDBMS, or null if it is an uncommon one
  • Method Details

    • createDialectHelper

      public static Dialect createDialectHelper(DialectFactory factory, DataSource dataSource)
      Creates a temporary connection and calls DialectFactory.createDialect(javax.sql.DataSource, java.sql.Connection).

      Helper method, called when createDialect is called without a Connection and the dialect factory cannot create a dialect with DataSource alone.

      It is a user error if dataSource is null (since this implies that createDialect was called with dataSource and connection both null.

      Parameters:
      factory - Dialect factory
      dataSource - 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 interface DialectFactory
      Parameters:
      dataSource - JDBC data source
      connection - 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