Package org.olap4j

Interface PreparedOlapStatement

All Superinterfaces:
AutoCloseable, OlapStatement, OlapWrapper, PreparedStatement, Statement, Wrapper

public interface PreparedOlapStatement extends PreparedStatement, OlapStatement
An object that represents a precompiled OLAP statement.

An OLAP statement is precompiled and stored in a PreparedOlapStatement object. This object can then be used to efficiently execute this statement multiple times.

A PreparedOlapStatement is generally created using OlapConnection.prepareOlapStatement(String).

Note: The setter methods (setShort, setString, and so on) for setting IN parameter values must specify types that are compatible with the defined type of the input parameter. For instance, if the IN parameter has type INTEGER, then the method setInt should be used.

If a parameter has Member type, use the PreparedStatement.setObject(int, Object) method to set it. A OlapException will be thrown if the object is not an instance of Member or does not belong to the correct Hierarchy.

The method getParameterMetaData() returns a description of the parameters, as in JDBC. The result is an OlapParameterMetaData.

Unlike JDBC, it is not necessary to assign a value to every parameter. This is because OLAP parameters have a default value. Parameters have their default value until they are set, and then retain their new values for each subsequent execution of this PreparedOlapStatement.

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

    • executeQuery

      CellSet executeQuery() throws OlapException
      Executes the MDX query in this PreparedOlapStatement object and returns the CellSet object generated by the query.
      Specified by:
      executeQuery in interface PreparedStatement
      Returns:
      an CellSet object that contains the data produced by the query; never null
      Throws:
      OlapException - if a database access error occurs
    • getParameterMetaData

      OlapParameterMetaData getParameterMetaData() throws OlapException
      Retrieves the number, types and properties of this PreparedOlapStatement object's parameters.
      Specified by:
      getParameterMetaData in interface PreparedStatement
      Returns:
      an OlapParameterMetaData object that contains information about the number, types and properties of this PreparedOlapStatement object's parameters
      Throws:
      OlapException - if a database access error occurs
      See Also:
    • getMetaData

      CellSetMetaData getMetaData() throws SQLException
      Retrieves a CellSetMetaData object that contains information about the axes and cells of the CellSet object that will be returned when this PreparedOlapStatement object is executed.
      Specified by:
      getMetaData in interface PreparedStatement
      Returns:
      the description of this CellSet's axes and cells
      Throws:
      OlapException - if a database access error occurs
      SQLException
    • getCube

      Cube getCube()
      Returns the cube (or virtual cube) which this statement is based upon.
      Returns:
      cube this statement is based upon
    • isSet

      boolean isSet(int parameterIndex) throws SQLException
      Returns whether the value of the designated parameter is set.

      Note that you cannot tell whether the parameter is set by looking to see whether the value is null, because null is a valid parameter value. When a parameter is not set, its value is derived by evaluating its default expression.

      To set the value call one of the setXxx methods. To unset the value, call unset(int).

      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      Returns:
      whether the parameter's value has been set
      Throws:
      SQLException - if a database access error occurs
    • unset

      void unset(int parameterIndex) throws SQLException
      Unsets the value of the designated parameter.
      Parameters:
      parameterIndex - the first parameter is 1, the second is 2, ...
      Throws:
      SQLException - if a database access error occurs
      See Also: