mondrian.server
Class StatementImpl

java.lang.Object
  extended by mondrian.server.StatementImpl
All Implemented Interfaces:
Statement
Direct Known Subclasses:
MondrianOlap4jStatement

public abstract class StatementImpl
extends Object
implements Statement

Implementation of Statement.

Not part of Mondrian's public API. This class may change without notice.

Author:
jhyde

Field Summary
protected  Query query
           
protected  long queryTimeout
          Query timeout, in milliseconds
 
Constructor Summary
StatementImpl()
          Creates a StatementImpl.
 
Method Summary
 void cancel()
          Issues a cancel request on this statement.
 void checkCancelOrTimeout()
          Checks if either a cancel request has been issued on the query or the execution time has exceeded the timeout value (if one has been set).
 void enableProfiling(ProfileHandler profileHandler)
          Enables profiling.
 void end(Execution execution)
          Ends the current execution.
 Execution getCurrentExecution()
          Returns execution context if currently executing, null otherwise.
 long getId()
          Returns the ID of this statement, unique within the JVM.
 ProfileHandler getProfileHandler()
           
 Object getProperty(String name)
           
 Query getQuery()
           
 long getQueryTimeoutMillis()
          Returns the query timeout of this statement, in milliseconds.
 RolapSchema getSchema()
          Returns this statement's schema.
 SchemaReader getSchemaReader()
          Returns this statement's schema reader.
 void setQuery(Query query)
           
 void setQueryTimeoutMillis(long timeoutMillis)
          Sets the timeout of this statement, in milliseconds.
 void start(Execution execution)
          Starts an execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface mondrian.server.Statement
close, getMondrianConnection
 

Field Detail

query

protected Query query

queryTimeout

protected long queryTimeout
Query timeout, in milliseconds

Constructor Detail

StatementImpl

public StatementImpl()
Creates a StatementImpl.

Method Detail

start

public void start(Execution execution)
Description copied from interface: Statement
Starts an execution.

Specified by:
start in interface Statement
Parameters:
execution - Execution context

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 interface Statement
Throws:
SQLException - on error

end

public void end(Execution execution)
Description copied from interface: Statement
Ends the current execution.

Specified by:
end in interface Statement
Parameters:
execution - Execution; must match the execution that was started

enableProfiling

public void enableProfiling(ProfileHandler profileHandler)
Description copied from interface: Statement
Enables profiling.

Profiling information will be sent to the given writer when Result.close() is called.

If profileHandler is null, disables profiling.

Specified by:
enableProfiling in interface Statement
Parameters:
profileHandler - Writer to which to send profiling information

getProfileHandler

public ProfileHandler getProfileHandler()
Specified by:
getProfileHandler in interface Statement

setQueryTimeoutMillis

public void setQueryTimeoutMillis(long timeoutMillis)
Description copied from interface: Statement
Sets the timeout of this statement, in milliseconds.

Zero means no timeout.

Contrast with JDBC's Statement.setQueryTimeout(int) method, which uses an int value and a granularity of seconds.

Specified by:
setQueryTimeoutMillis in interface Statement
Parameters:
timeoutMillis - Timeout in milliseconds

getQueryTimeoutMillis

public long getQueryTimeoutMillis()
Description copied from interface: Statement
Returns the query timeout of this statement, in milliseconds.

Zero means no timeout.

Contrast with JDBC's Statement.getQueryTimeout() method, which uses an int value and a granularity of seconds.

Specified by:
getQueryTimeoutMillis in interface Statement
Returns:
Timeout in milliseconds

checkCancelOrTimeout

public void checkCancelOrTimeout()
Description copied from interface: Statement
Checks if either a cancel request has been issued on the query or the execution time has exceeded the timeout value (if one has been set). Exceptions are raised if either of these two conditions are met. This method should be called periodically during query execution to ensure timely detection of these events, particularly before/after any potentially long running operations.

Specified by:
checkCancelOrTimeout in interface Statement

getSchemaReader

public SchemaReader getSchemaReader()
Description copied from interface: Statement
Returns this statement's schema reader.

Specified by:
getSchemaReader in interface Statement
Returns:
Schema reader, not null

getSchema

public RolapSchema getSchema()
Description copied from interface: Statement
Returns this statement's schema.

Specified by:
getSchema in interface Statement
Returns:
Schema, not null

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface Statement

getQuery

public Query getQuery()
Specified by:
getQuery in interface Statement

setQuery

public void setQuery(Query query)
Specified by:
setQuery in interface Statement

getCurrentExecution

public Execution getCurrentExecution()
Description copied from interface: Statement
Returns execution context if currently executing, null otherwise.

Specified by:
getCurrentExecution in interface Statement
Returns:
Execution context

getId

public long getId()
Description copied from interface: Statement
Returns the ID of this statement, unique within the JVM.

Specified by:
getId in interface Statement
Returns:
Unique ID of this statement

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads