Package mondrian.olap4j
Class MondrianOlap4jStatement
- java.lang.Object
-
- mondrian.server.StatementImpl
-
- mondrian.olap4j.MondrianOlap4jStatement
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.sql.Statement
,java.sql.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
-
-
Constructor Summary
Constructors Constructor Description MondrianOlap4jStatement(MondrianOlap4jConnection olap4jConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBatch(java.lang.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(java.lang.String sql)
boolean
execute(java.lang.String sql, int autoGeneratedKeys)
boolean
execute(java.lang.String sql, int[] columnIndexes)
boolean
execute(java.lang.String sql, java.lang.String[] columnNames)
int[]
executeBatch()
CellSet
executeOlapQuery(java.lang.String mdx)
CellSet
executeOlapQuery(SelectNode selectNode)
protected CellSet
executeOlapQueryInternal(Query query, MondrianOlap4jCellSetMetaData cellSetMetaData)
Executes a parsed query, closing any previously open cellset.java.sql.ResultSet
executeQuery(java.lang.String mdx)
(package private) java.sql.ResultSet
executeQuery2(java.lang.String mdx, boolean advanced, java.lang.String tabFields, int[] rowCountSlot)
int
executeUpdate(java.lang.String sql)
int
executeUpdate(java.lang.String sql, int autoGeneratedKeys)
int
executeUpdate(java.lang.String sql, int[] columnIndexes)
int
executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
OlapConnection
getConnection()
int
getFetchDirection()
int
getFetchSize()
java.sql.ResultSet
getGeneratedKeys()
int
getMaxFieldSize()
int
getMaxRows()
RolapConnection
getMondrianConnection()
Returns this statement's connection.boolean
getMoreResults()
boolean
getMoreResults(int current)
int
getQueryTimeout()
java.sql.ResultSet
getResultSet()
int
getResultSetConcurrency()
int
getResultSetHoldability()
int
getResultSetType()
int
getUpdateCount()
java.sql.SQLWarning
getWarnings()
boolean
isClosed()
boolean
isPoolable()
boolean
isWrapperFor(java.lang.Class<?> iface)
(package private) void
onResultSetClose(java.sql.ResultSet resultSet)
Called by each child result set (most likely a cell set) when it is closed.protected Pair<Query,MondrianOlap4jCellSetMetaData>
parseQuery(java.lang.String mdx)
void
setCursorName(java.lang.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(java.lang.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 java.sql.ResultSet executeQuery(java.lang.String mdx) throws java.sql.SQLException
- Specified by:
executeQuery
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
executeQuery2
java.sql.ResultSet executeQuery2(java.lang.String mdx, boolean advanced, java.lang.String tabFields, int[] rowCountSlot) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
close
public void close()
Description copied from interface:Statement
Closes this statement.
-
getMaxFieldSize
public int getMaxFieldSize() throws java.sql.SQLException
- Specified by:
getMaxFieldSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws java.sql.SQLException
- Specified by:
setMaxFieldSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getMaxRows
public int getMaxRows() throws java.sql.SQLException
- Specified by:
getMaxRows
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setMaxRows
public void setMaxRows(int max) throws java.sql.SQLException
- Specified by:
setMaxRows
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws java.sql.SQLException
- Specified by:
setEscapeProcessing
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getQueryTimeout
public int getQueryTimeout() throws java.sql.SQLException
- Specified by:
getQueryTimeout
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws java.sql.SQLException
- Specified by:
setQueryTimeout
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
cancel
public void cancel() throws java.sql.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 interfacejava.sql.Statement
- Specified by:
cancel
in interfaceStatement
- Overrides:
cancel
in classStatementImpl
- Throws:
java.sql.SQLException
- on error
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- Specified by:
getWarnings
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException
- Specified by:
clearWarnings
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException
- Specified by:
setCursorName
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException
- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
- Specified by:
getResultSet
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getUpdateCount
public int getUpdateCount() throws java.sql.SQLException
- Specified by:
getUpdateCount
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getMoreResults
public boolean getMoreResults() throws java.sql.SQLException
- Specified by:
getMoreResults
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws java.sql.SQLException
- Specified by:
setFetchDirection
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getFetchDirection
public int getFetchDirection() throws java.sql.SQLException
- Specified by:
getFetchDirection
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setFetchSize
public void setFetchSize(int rows) throws java.sql.SQLException
- Specified by:
setFetchSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getFetchSize
public int getFetchSize() throws java.sql.SQLException
- Specified by:
getFetchSize
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException
- Specified by:
getResultSetConcurrency
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getResultSetType
public int getResultSetType() throws java.sql.SQLException
- Specified by:
getResultSetType
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
addBatch
public void addBatch(java.lang.String sql) throws java.sql.SQLException
- Specified by:
addBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
clearBatch
public void clearBatch() throws java.sql.SQLException
- Specified by:
clearBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
executeBatch
public int[] executeBatch() throws java.sql.SQLException
- Specified by:
executeBatch
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getConnection
public OlapConnection getConnection()
- Specified by:
getConnection
in interfaceOlapStatement
- Specified by:
getConnection
in interfacejava.sql.Statement
-
getMoreResults
public boolean getMoreResults(int current) throws java.sql.SQLException
- Specified by:
getMoreResults
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getGeneratedKeys
public java.sql.ResultSet getGeneratedKeys() throws java.sql.SQLException
- Specified by:
getGeneratedKeys
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
- Specified by:
executeUpdate
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
execute
public boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
- Specified by:
execute
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
getResultSetHoldability
public int getResultSetHoldability() throws java.sql.SQLException
- Specified by:
getResultSetHoldability
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
isClosed
public boolean isClosed() throws java.sql.SQLException
- Specified by:
isClosed
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws java.sql.SQLException
- Specified by:
setPoolable
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
isPoolable
public boolean isPoolable() throws java.sql.SQLException
- Specified by:
isPoolable
in interfacejava.sql.Statement
- Throws:
java.sql.SQLException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
- Specified by:
unwrap
in interfaceOlapWrapper
- Specified by:
unwrap
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
- Specified by:
isWrapperFor
in interfaceOlapWrapper
- Specified by:
isWrapperFor
in interfacejava.sql.Wrapper
- Throws:
java.sql.SQLException
-
executeOlapQuery
public CellSet executeOlapQuery(java.lang.String mdx) throws OlapException
- Specified by:
executeOlapQuery
in interfaceOlapStatement
- Throws:
OlapException
-
parseQuery
protected Pair<Query,MondrianOlap4jCellSetMetaData> parseQuery(java.lang.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(java.sql.ResultSet resultSet)
Called by each child result set (most likely a cell set) when it is closed.- Parameters:
resultSet
- Result set or cell set
-
-