Package mondrian.olap4j
Class MondrianOlap4jStatement
- java.lang.Object
-
- mondrian.server.StatementImpl
-
- mondrian.olap4j.MondrianOlap4jStatement
-
- All Implemented Interfaces:
AutoCloseable,Statement,Wrapper,Statement,OlapStatement,OlapWrapper
- Direct Known Subclasses:
MondrianOlap4jPreparedStatement
abstract class MondrianOlap4jStatement extends StatementImpl implements OlapStatement, Statement
Implementation ofOlapStatementfor the Mondrian OLAP engine.- Since:
- May 24, 2007
- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancloseOnCompletionSupport forStatement.closeOnCompletion()method.(package private) MondrianOlap4jConnectionolap4jConnection(package private) MondrianOlap4jCellSetopenCellSetCurrent cell set, or null if the statement is not executing anything.-
Fields inherited from class mondrian.server.StatementImpl
query, queryTimeout
-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Constructor Summary
Constructors Constructor Description MondrianOlap4jStatement(MondrianOlap4jConnection olap4jConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatch(String sql)voidaddListener(CellSetListener.Granularity granularity, CellSetListener cellSetListener)voidcancel()Issues a cancel request on this statement.voidclearBatch()voidclearWarnings()voidclose()Closes this statement.booleanexecute(String sql)booleanexecute(String sql, int autoGeneratedKeys)booleanexecute(String sql, int[] columnIndexes)booleanexecute(String sql, String[] columnNames)int[]executeBatch()CellSetexecuteOlapQuery(String mdx)CellSetexecuteOlapQuery(SelectNode selectNode)protected CellSetexecuteOlapQueryInternal(Query query, MondrianOlap4jCellSetMetaData cellSetMetaData)Executes a parsed query, closing any previously open cellset.ResultSetexecuteQuery(String mdx)(package private) ResultSetexecuteQuery2(String mdx, boolean advanced, String tabFields, int[] rowCountSlot)intexecuteUpdate(String sql)intexecuteUpdate(String sql, int autoGeneratedKeys)intexecuteUpdate(String sql, int[] columnIndexes)intexecuteUpdate(String sql, String[] columnNames)OlapConnectiongetConnection()intgetFetchDirection()intgetFetchSize()ResultSetgetGeneratedKeys()intgetMaxFieldSize()intgetMaxRows()RolapConnectiongetMondrianConnection()Returns this statement's connection.booleangetMoreResults()booleangetMoreResults(int current)intgetQueryTimeout()ResultSetgetResultSet()intgetResultSetConcurrency()intgetResultSetHoldability()intgetResultSetType()intgetUpdateCount()SQLWarninggetWarnings()booleanisClosed()booleanisPoolable()booleanisWrapperFor(Class<?> iface)(package private) voidonResultSetClose(ResultSet resultSet)Called by each child result set (most likely a cell set) when it is closed.protected Pair<Query,MondrianOlap4jCellSetMetaData>parseQuery(String mdx)voidsetCursorName(String name)voidsetEscapeProcessing(boolean enable)voidsetFetchDirection(int direction)voidsetFetchSize(int rows)voidsetMaxFieldSize(int max)voidsetMaxRows(int max)voidsetPoolable(boolean poolable)voidsetQueryTimeout(int seconds)voidstart(Execution execution)Starts an execution.<T> Tunwrap(Class<T> iface)-
Methods inherited from class mondrian.server.StatementImpl
checkCancelOrTimeout, enableProfiling, end, getCurrentExecution, getId, getProfileHandler, getProperty, getQuery, getQueryTimeoutMillis, getSchema, getSchemaReader, setQuery, setQueryTimeoutMillis
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Statement
closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, isCloseOnCompletion, isSimpleIdentifier, setLargeMaxRows
-
Methods inherited from interface mondrian.server.Statement
checkCancelOrTimeout, enableProfiling, end, getCurrentExecution, getId, getProfileHandler, getProperty, getQuery, getQueryTimeoutMillis, getSchema, getSchemaReader, setQuery, setQueryTimeoutMillis
-
-
-
-
Field Detail
-
olap4jConnection
final MondrianOlap4jConnection olap4jConnection
-
closeOnCompletion
protected boolean closeOnCompletion
Support forStatement.closeOnCompletion()method.
-
openCellSet
MondrianOlap4jCellSet openCellSet
Current cell set, or null if the statement is not executing anything. Any method which modifies this member must synchronize on the MondrianOlap4jStatement.
-
-
Constructor Detail
-
MondrianOlap4jStatement
MondrianOlap4jStatement(MondrianOlap4jConnection olap4jConnection)
-
-
Method Detail
-
executeQuery
public ResultSet executeQuery(String mdx) throws SQLException
- Specified by:
executeQueryin interfaceStatement- Throws:
SQLException
-
executeQuery2
ResultSet executeQuery2(String mdx, boolean advanced, String tabFields, int[] rowCountSlot) throws SQLException
- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
close
public void close()
Description copied from interface:StatementCloses this statement.
-
getMaxFieldSize
public int getMaxFieldSize() throws SQLException- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
getMaxRows
public int getMaxRows() throws SQLException- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
public void setMaxRows(int max) throws SQLException- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLException- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
public int getQueryTimeout() throws SQLException- Specified by:
getQueryTimeoutin interfaceStatement- Throws:
SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException- Specified by:
setQueryTimeoutin interfaceStatement- Throws:
SQLException
-
cancel
public void cancel() throws SQLExceptionDescription copied from interface:StatementIssues a cancel request on this statement.Once the thread running the statement detects the cancel request, execution will throw an exception. See
BasicQueryTest.testCancelfor an example of usage of this method.- Specified by:
cancelin interfaceStatement- Specified by:
cancelin interfaceStatement- Overrides:
cancelin classStatementImpl- Throws:
SQLException- on error
-
getWarnings
public SQLWarning getWarnings() throws SQLException
- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
public void clearWarnings() throws SQLException- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
setCursorName
public void setCursorName(String name) throws SQLException
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet() throws SQLException
- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getUpdateCount
public int getUpdateCount() throws SQLException- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getMoreResults
public boolean getMoreResults() throws SQLException- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws SQLException- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
public int getFetchDirection() throws SQLException- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
setFetchSize
public void setFetchSize(int rows) throws SQLException- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getFetchSize
public int getFetchSize() throws SQLException- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws SQLException- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
public int getResultSetType() throws SQLException- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
addBatch
public void addBatch(String sql) throws SQLException
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
public void clearBatch() throws SQLException- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
executeBatch
public int[] executeBatch() throws SQLException- Specified by:
executeBatchin interfaceStatement- Throws:
SQLException
-
getConnection
public OlapConnection getConnection()
- Specified by:
getConnectionin interfaceOlapStatement- Specified by:
getConnectionin interfaceStatement
-
getMoreResults
public boolean getMoreResults(int current) throws SQLException- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, String[] columnNames) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, String[] columnNames) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
public int getResultSetHoldability() throws SQLException- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
isClosed
public boolean isClosed() throws SQLException- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws SQLException- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isPoolable
public boolean isPoolable() throws SQLException- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceOlapWrapper- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceOlapWrapper- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
executeOlapQuery
public CellSet executeOlapQuery(String mdx) throws OlapException
- Specified by:
executeOlapQueryin interfaceOlapStatement- Throws:
OlapException
-
parseQuery
protected Pair<Query,MondrianOlap4jCellSetMetaData> parseQuery(String mdx) throws OlapException
- Throws:
OlapException
-
executeOlapQueryInternal
protected CellSet executeOlapQueryInternal(Query query, MondrianOlap4jCellSetMetaData cellSetMetaData) throws OlapException
Executes a parsed query, closing any previously open cellset.- Parameters:
query- Parsed querycellSetMetaData- Cell set metadata- Returns:
- Cell set
- Throws:
OlapException- if a database error occurs
-
start
public void start(Execution execution)
Description copied from interface:StatementStarts an execution.- Specified by:
startin interfaceStatement- Overrides:
startin classStatementImpl- Parameters:
execution- Execution context
-
executeOlapQuery
public CellSet executeOlapQuery(SelectNode selectNode) throws OlapException
- Specified by:
executeOlapQueryin interfaceOlapStatement- Throws:
OlapException
-
addListener
public void addListener(CellSetListener.Granularity granularity, CellSetListener cellSetListener) throws OlapException
- Specified by:
addListenerin interfaceOlapStatement- Throws:
OlapException
-
getMondrianConnection
public RolapConnection getMondrianConnection()
Description copied from interface:StatementReturns this statement's connection.- Specified by:
getMondrianConnectionin interfaceStatement- Returns:
- connection
-
onResultSetClose
void onResultSetClose(ResultSet resultSet)
Called by each child result set (most likely a cell set) when it is closed.- Parameters:
resultSet- Result set or cell set
-
-