Interface PreparedOlapStatement
-
- All Superinterfaces:
java.lang.AutoCloseable
,OlapStatement
,OlapWrapper
,java.sql.PreparedStatement
,java.sql.Statement
,java.sql.Wrapper
public interface PreparedOlapStatement extends java.sql.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 usingOlapConnection.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 typeINTEGER
, then the methodsetInt
should be used.If a parameter has Member type, use the
PreparedStatement.setObject(int, Object)
method to set it. AOlapException
will be thrown if the object is not an instance ofMember
or does not belong to the correctHierarchy
.The method
getParameterMetaData()
returns a description of the parameters, as in JDBC. The result is anOlapParameterMetaData
.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:
OlapConnection.prepareOlapStatement(String)
,CellSet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CellSet
executeQuery()
Executes the MDX query in thisPreparedOlapStatement
object and returns theCellSet
object generated by the query.Cube
getCube()
Returns the cube (or virtual cube) which this statement is based upon.CellSetMetaData
getMetaData()
Retrieves aCellSetMetaData
object that contains information about the axes and cells of theCellSet
object that will be returned when thisPreparedOlapStatement
object is executed.OlapParameterMetaData
getParameterMetaData()
Retrieves the number, types and properties of thisPreparedOlapStatement
object's parameters.boolean
isSet(int parameterIndex)
Returns whether the value of the designated parameter is set.void
unset(int parameterIndex)
Unsets the value of the designated parameter.-
Methods inherited from interface org.olap4j.OlapStatement
addListener, executeOlapQuery, executeOlapQuery, getConnection
-
Methods inherited from interface org.olap4j.OlapWrapper
isWrapperFor, unwrap
-
Methods inherited from interface java.sql.PreparedStatement
addBatch, clearParameters, execute, executeLargeUpdate, executeUpdate, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Method Detail
-
executeQuery
CellSet executeQuery() throws OlapException
Executes the MDX query in thisPreparedOlapStatement
object and returns theCellSet
object generated by the query.- Specified by:
executeQuery
in interfacejava.sql.PreparedStatement
- Returns:
- an
CellSet
object that contains the data produced by the query; nevernull
- Throws:
OlapException
- if a database access error occurs
-
getParameterMetaData
OlapParameterMetaData getParameterMetaData() throws OlapException
Retrieves the number, types and properties of thisPreparedOlapStatement
object's parameters.- Specified by:
getParameterMetaData
in interfacejava.sql.PreparedStatement
- Returns:
- an
OlapParameterMetaData
object that contains information about the number, types and properties of thisPreparedOlapStatement
object's parameters - Throws:
OlapException
- if a database access error occurs- See Also:
OlapParameterMetaData
-
getMetaData
CellSetMetaData getMetaData() throws java.sql.SQLException
Retrieves aCellSetMetaData
object that contains information about the axes and cells of theCellSet
object that will be returned when thisPreparedOlapStatement
object is executed.- Specified by:
getMetaData
in interfacejava.sql.PreparedStatement
- Returns:
- the description of this
CellSet
's axes and cells - Throws:
OlapException
- if a database access error occursjava.sql.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 java.sql.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
, becausenull
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, callunset(int)
.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...- Returns:
- whether the parameter's value has been set
- Throws:
java.sql.SQLException
- if a database access error occurs
-
unset
void unset(int parameterIndex) throws java.sql.SQLException
Unsets the value of the designated parameter.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...- Throws:
java.sql.SQLException
- if a database access error occurs- See Also:
isSet(int)
-
-