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 ofOlapStatement
for the Mondrian OLAP engine.- Since:
- May 24, 2007
- Author:
- jhyde
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
closeOnCompletion
Support forStatement.closeOnCompletion()
method.(package private) MondrianOlap4jConnection
olap4jConnection
(package private) MondrianOlap4jCellSet
openCellSet
Current 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 void
addBatch(String sql)
void
addListener(CellSetListener.Granularity granularity, CellSetListener cellSetListener)
void
cancel()
Issues a cancel request on this statement.void
clearBatch()
void
clearWarnings()
void
close()
Closes this statement.boolean
execute(String sql)
boolean
execute(String sql, int autoGeneratedKeys)
boolean
execute(String sql, int[] columnIndexes)
boolean
execute(String sql, String[] columnNames)
int[]
executeBatch()
CellSet
executeOlapQuery(String mdx)
CellSet
executeOlapQuery(SelectNode selectNode)
protected CellSet
executeOlapQueryInternal(Query query, MondrianOlap4jCellSetMetaData cellSetMetaData)
Executes a parsed query, closing any previously open cellset.ResultSet
executeQuery(String mdx)
(package private) ResultSet
executeQuery2(String mdx, boolean advanced, String tabFields, int[] rowCountSlot)
int
executeUpdate(String sql)
int
executeUpdate(String sql, int autoGeneratedKeys)
int
executeUpdate(String sql, int[] columnIndexes)
int
executeUpdate(String sql, String[] columnNames)
OlapConnection
getConnection()
int
getFetchDirection()
int
getFetchSize()
ResultSet
getGeneratedKeys()
int
getMaxFieldSize()
int
getMaxRows()
RolapConnection
getMondrianConnection()
Returns this statement's connection.boolean
getMoreResults()
boolean
getMoreResults(int current)
int
getQueryTimeout()
ResultSet
getResultSet()
int
getResultSetConcurrency()
int
getResultSetHoldability()
int
getResultSetType()
int
getUpdateCount()
SQLWarning
getWarnings()
boolean
isClosed()
boolean
isPoolable()
boolean
isWrapperFor(Class<?> iface)
(package private) void
onResultSetClose(ResultSet resultSet)
Called by each child result set (most likely a cell set) when it is closed.protected Pair<Query,MondrianOlap4jCellSetMetaData>
parseQuery(String mdx)
void
setCursorName(String name)
void
setEscapeProcessing(boolean enable)
void
setFetchDirection(int direction)
void
setFetchSize(int rows)
void
setMaxFieldSize(int max)
void
setMaxRows(int max)
void
setPoolable(boolean poolable)
void
setQueryTimeout(int seconds)
void
start(Execution execution)
Starts an execution.<T> T
unwrap(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:
executeQuery
in 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:
executeUpdate
in interfaceStatement
- Throws:
SQLException
-
close
public void close()
Description copied from interface:Statement
Closes this statement.
-
getMaxFieldSize
public int getMaxFieldSize() throws SQLException
- Specified by:
getMaxFieldSize
in interfaceStatement
- Throws:
SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException
- Specified by:
setMaxFieldSize
in interfaceStatement
- Throws:
SQLException
-
getMaxRows
public int getMaxRows() throws SQLException
- Specified by:
getMaxRows
in interfaceStatement
- Throws:
SQLException
-
setMaxRows
public void setMaxRows(int max) throws SQLException
- Specified by:
setMaxRows
in interfaceStatement
- Throws:
SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLException
- Specified by:
setEscapeProcessing
in interfaceStatement
- Throws:
SQLException
-
getQueryTimeout
public int getQueryTimeout() throws SQLException
- Specified by:
getQueryTimeout
in interfaceStatement
- Throws:
SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException
- Specified by:
setQueryTimeout
in interfaceStatement
- Throws:
SQLException
-
cancel
public void cancel() throws SQLException
Description copied from interface:Statement
Issues a cancel request on this statement.Once the thread running the statement detects the cancel request, execution will throw an exception. See
BasicQueryTest.testCancel
for an example of usage of this method.- Specified by:
cancel
in interfaceStatement
- Specified by:
cancel
in interfaceStatement
- Overrides:
cancel
in classStatementImpl
- Throws:
SQLException
- on error
-
getWarnings
public SQLWarning getWarnings() throws SQLException
- Specified by:
getWarnings
in interfaceStatement
- Throws:
SQLException
-
clearWarnings
public void clearWarnings() throws SQLException
- Specified by:
clearWarnings
in interfaceStatement
- Throws:
SQLException
-
setCursorName
public void setCursorName(String name) throws SQLException
- Specified by:
setCursorName
in interfaceStatement
- Throws:
SQLException
-
execute
public boolean execute(String sql) throws SQLException
- Specified by:
execute
in interfaceStatement
- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet() throws SQLException
- Specified by:
getResultSet
in interfaceStatement
- Throws:
SQLException
-
getUpdateCount
public int getUpdateCount() throws SQLException
- Specified by:
getUpdateCount
in interfaceStatement
- Throws:
SQLException
-
getMoreResults
public boolean getMoreResults() throws SQLException
- Specified by:
getMoreResults
in interfaceStatement
- Throws:
SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws SQLException
- Specified by:
setFetchDirection
in interfaceStatement
- Throws:
SQLException
-
getFetchDirection
public int getFetchDirection() throws SQLException
- Specified by:
getFetchDirection
in interfaceStatement
- Throws:
SQLException
-
setFetchSize
public void setFetchSize(int rows) throws SQLException
- Specified by:
setFetchSize
in interfaceStatement
- Throws:
SQLException
-
getFetchSize
public int getFetchSize() throws SQLException
- Specified by:
getFetchSize
in interfaceStatement
- Throws:
SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws SQLException
- Specified by:
getResultSetConcurrency
in interfaceStatement
- Throws:
SQLException
-
getResultSetType
public int getResultSetType() throws SQLException
- Specified by:
getResultSetType
in interfaceStatement
- Throws:
SQLException
-
addBatch
public void addBatch(String sql) throws SQLException
- Specified by:
addBatch
in interfaceStatement
- Throws:
SQLException
-
clearBatch
public void clearBatch() throws SQLException
- Specified by:
clearBatch
in interfaceStatement
- Throws:
SQLException
-
executeBatch
public int[] executeBatch() throws SQLException
- Specified by:
executeBatch
in interfaceStatement
- Throws:
SQLException
-
getConnection
public OlapConnection getConnection()
- Specified by:
getConnection
in interfaceOlapStatement
- Specified by:
getConnection
in interfaceStatement
-
getMoreResults
public boolean getMoreResults(int current) throws SQLException
- Specified by:
getMoreResults
in interfaceStatement
- Throws:
SQLException
-
getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException
- Specified by:
getGeneratedKeys
in interfaceStatement
- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executeUpdate
in interfaceStatement
- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executeUpdate
in interfaceStatement
- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, String[] columnNames) throws SQLException
- Specified by:
executeUpdate
in interfaceStatement
- Throws:
SQLException
-
execute
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
execute
in interfaceStatement
- Throws:
SQLException
-
execute
public boolean execute(String sql, int[] columnIndexes) throws SQLException
- Specified by:
execute
in interfaceStatement
- Throws:
SQLException
-
execute
public boolean execute(String sql, String[] columnNames) throws SQLException
- Specified by:
execute
in interfaceStatement
- Throws:
SQLException
-
getResultSetHoldability
public int getResultSetHoldability() throws SQLException
- Specified by:
getResultSetHoldability
in interfaceStatement
- Throws:
SQLException
-
isClosed
public boolean isClosed() throws SQLException
- Specified by:
isClosed
in interfaceStatement
- Throws:
SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws SQLException
- Specified by:
setPoolable
in interfaceStatement
- Throws:
SQLException
-
isPoolable
public boolean isPoolable() throws SQLException
- Specified by:
isPoolable
in interfaceStatement
- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrap
in interfaceOlapWrapper
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperFor
in interfaceOlapWrapper
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
executeOlapQuery
public CellSet executeOlapQuery(String mdx) throws OlapException
- Specified by:
executeOlapQuery
in 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:Statement
Starts an execution.- Specified by:
start
in interfaceStatement
- Overrides:
start
in classStatementImpl
- Parameters:
execution
- Execution context
-
executeOlapQuery
public CellSet executeOlapQuery(SelectNode selectNode) throws OlapException
- Specified by:
executeOlapQuery
in interfaceOlapStatement
- Throws:
OlapException
-
addListener
public void addListener(CellSetListener.Granularity granularity, CellSetListener cellSetListener) throws OlapException
- Specified by:
addListener
in interfaceOlapStatement
- Throws:
OlapException
-
getMondrianConnection
public RolapConnection getMondrianConnection()
Description copied from interface:Statement
Returns this statement's connection.- Specified by:
getMondrianConnection
in 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
-
-