Java Doc for CompiledStatementManager.java in  » Database-DBMS » hsql » org » hsqldb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » hsql » org.hsqldb 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.CompiledStatementManager

CompiledStatementManager
final class CompiledStatementManager (Code)
This class manages the reuse of CompiledStatement objects for prepared statements for a Database 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 CompiledStatement objects to become invalidated. This is done by setting to null all the managed CompiledStatement instances, while keeping their id and sql string. When a session subsequently attempts to use an invalidated (null) CompiledStatement via its id, it will reinstantiate the CompiledStatement using its sql statement still held by this class.

This class keeps count of the number of different sessions that are linked to each registered compiled statement, and the number of times each session is linked. 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 keeping references to CompiledStatement objects after DDL changes which could result in memory leaks. Modified further to support schemas.


author:
   boucherb@users
author:
   fredt@users
since:
   1.7.2
version:
   1.8.0




Constructor Summary
 CompiledStatementManager(Database database)
     Constructs a new instance of CompiledStatementManager.

Method Summary
synchronized  CompiledStatementcompile(Session session, String sql)
     Retrieves a MULTI Result describing three aspects of the CompiledStatement prepared from the SQL argument for execution in this session context.
 voidfreeStatement(int csid, int sid, boolean freeAll)
     Removes one (or all) of the links between a session and a compiled statement.
synchronized  CompiledStatementgetStatement(Session session, int csid)
     Returns an existing CompiledStatement object with the given statement identifier.
synchronized  voidremoveSession(int sid)
     Releases the link betwen the session and all compiled statement objects it is linked to.
synchronized  voidreset()
     Clears all internal data structures, removing any references to compiled statements.
synchronized  voidresetStatements()
     Used after a DDL change that could impact the compiled statements.


Constructor Detail
CompiledStatementManager
CompiledStatementManager(Database database)(Code)
Constructs a new instance of CompiledStatementManager.
Parameters:
  database - the Database instance for which this object is tomanage compiled statement objects.




Method Detail
compile
synchronized CompiledStatement compile(Session session, String sql) throws Throwable(Code)
Retrieves a MULTI Result describing three aspects of the CompiledStatement prepared from the SQL argument for execution in this session context.

  1. A PREPARE_ACK mode Result describing id of the statement prepared by this request. This is used by the JDBC implementation to later identify to the engine which prepared statement to execute.
  2. A DATA mode result describing the statement's result set metadata. This is used to generate the JDBC ResultSetMetaData object returned by PreparedStatement.getMetaData and CallableStatement.getMetaData.
  3. A DATA mode result describing the statement's parameter metdata. This is used to by the JDBC implementation to determine how to send parameters back to the engine when executing the statement. It is also used to construct the JDBC ParameterMetaData object for PreparedStatements and CallableStatements.
    Parameters:
      session - the session
    Parameters:
      sql - a string describing the desired statement object a MULTI Result describing the compiled statement.



freeStatement
void freeStatement(int csid, int sid, boolean freeAll)(Code)
Removes one (or all) of the links between a session and a compiled statement. If the statement is not linked with any other session, it is removed from management.
Parameters:
  csid - the compiled statment identifier
Parameters:
  sid - the session identifier
Parameters:
  freeAll - if true, remove all links to the session



getStatement
synchronized CompiledStatement getStatement(Session session, int csid)(Code)
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 session
Parameters:
  csid - the identifier of the requested CompiledStatement object the requested CompiledStatement object



removeSession
synchronized void removeSession(int sid)(Code)
Releases the link betwen the session and all compiled statement objects it is linked to. If any such statement is not linked with any other session, it is removed from management.
Parameters:
  sid - the session identifier



reset
synchronized void reset()(Code)
Clears all internal data structures, removing any references to compiled statements.



resetStatements
synchronized void resetStatements()(Code)
Used after a DDL change that could impact the compiled statements. Clears references to CompiledStatement objects while keeping the counts and references to the sql strings.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.