Package org.olap4j

Interface OlapStatement

All Superinterfaces:
AutoCloseable, OlapWrapper, Statement, Wrapper
All Known Subinterfaces:
PreparedOlapStatement

public interface OlapStatement extends Statement, OlapWrapper
Object used for statically executing an MDX statement and returning a CellSet.

An OlapStatement is generally created using OlapConnection.createStatement().

Since:
Aug 22, 2006
Author:
jhyde
See Also:
  • Method Details

    • getConnection

      OlapConnection getConnection() throws SQLException
      Retrieves the OlapConnection object that produced this OlapStatement object.
      Specified by:
      getConnection in interface Statement
      Throws:
      SQLException
    • executeOlapQuery

      CellSet executeOlapQuery(String mdx) throws OlapException
      Executes an OLAP statement.
      Parameters:
      mdx - MDX SELECT statement
      Returns:
      Cell set
      Throws:
      OlapException - if a database access error occurs, this method is called on a closed OlapStatement, the query times out (see Statement.setQueryTimeout(int)) or another thread cancels the statement (see Statement.cancel())
    • executeOlapQuery

      CellSet executeOlapQuery(SelectNode selectNode) throws OlapException
      Executes an OLAP statement expressed as a parse tree.

      Validates the parse tree before executing it.

      Parameters:
      selectNode - Parse tree of MDX SELECT statement
      Returns:
      Cell set
      Throws:
      OlapException - if a database access error occurs, this method is called on a closed OlapStatement, the query times out (see Statement.setQueryTimeout(int)) or another thread cancels the statement (see Statement.cancel())
    • addListener

      void addListener(CellSetListener.Granularity granularity, CellSetListener listener) throws OlapException
      Adds a listener to be notified of events to CellSets created by this statement.

      NOTE: You may wonder why this method belongs to the OlapStatement class and not CellSet. If the method belonged to CellSet there would be a window between creation and registering a listener during which events might be lost, whereas registering the listener with the statement ensures that the listener is attached immediately that the cell set is opened. It follows that registering a listener does not affect the cell set currently open (if any), and that no events will be received if the statement has no open cell sets.

      Parameters:
      granularity - Granularity of cell set events to listen for
      listener - Listener to be notified of changes
      Throws:
      OlapException - if granularity is not one supported by this server, per the OlapDatabaseMetaData.getSupportedCellSetListenerGranularities() method