Class StatementManager
- java.lang.Object
-
- org.hsqldb.StatementManager
-
public final class StatementManager extends java.lang.ObjectThis class manages the reuse of Statement objects for prepared statements for a Session instance.A compiled statement is registered by a session to be managed. Once registered, it is linked with one or more sessions.
The sql statement text distinguishes different compiled statements and acts as lookup key when a session initially looks for an existing instance of the compiled sql statement.
Once a session is linked with a statement, it uses the uniqe compiled statement id for the sql statement to access the statement.
Changes to database structure via DDL statements, will result in all registered Statement objects to become invalidated. This is done by comparing the schema change and compile timestamps. When a session subsequently attempts to use an invalidated Statement via its id, it will reinstantiate the Statement using its sql statement still held by this class.
This class keeps count of the number of time each registered compiled statement is linked to a session. It unregisters a compiled statement when no session remains linked to it.
Modified by fredt@users from the original by boucherb@users to simplify, support multiple identical prepared statements per session, and avoid memory leaks. Modified further to support schemas. Changed implementation in 1.9 as a session object
- Since:
- 1.7.2
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description StatementgetStatement(Session session, long csid)Returns an existing CompiledStatement object with the given statement identifier.StatementgetStatement(Session session, Statement statement)Recompiles a statement
-
-
-
Method Detail
-
getStatement
public Statement getStatement(Session session, long csid)
Returns an existing CompiledStatement object with the given statement identifier. Returns null if the CompiledStatement object has been invalidated and cannot be recompiled- Parameters:
session- the sessioncsid- the identifier of the requested CompiledStatement object- Returns:
- the requested CompiledStatement object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG