Source Code Cross Referenced for OptimizerTrace.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » db » 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 » db derby 10.2 » org.apache.derby.iapi.db 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.db.OptimizerTrace
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.iapi.db;
023:
024:        import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
025:        import org.apache.derby.iapi.sql.conn.ConnectionUtil;
026:
027:        /**
028:         <P>
029:         This  class provides static methods for controlling the
030:         optimizer tracing in a Cloudscape database.
031:        
032:         <P>
033:         <i>
034:         Cloudscape reserves the right to change, rename, or remove this interface
035:         at any time. </i>
036:         */
037:        public class OptimizerTrace {
038:            /**
039:             * Control whether or not optimizer trace is on.
040:             *
041:             * @param onOrOff    Whether to turn optimizer trace on (true) or off (false).
042:             *
043:             * @return Whether or not the call was successful.  (false will be returned when optimizer tracing is not supported.)
044:             */
045:            public static boolean setOptimizerTrace(boolean onOrOff) {
046:                boolean retCode = false;
047:
048:                try {
049:                    // Get the current language connection context.  This is associated
050:                    // with the current database.
051:                    LanguageConnectionContext lcc = ConnectionUtil
052:                            .getCurrentLCC();
053:                    retCode = lcc.setOptimizerTrace(onOrOff);
054:                } catch (Throwable t) {
055:                    // eat all exceptions, simply return false
056:                }
057:
058:                return retCode;
059:            }
060:
061:            /**
062:             * Control whether or not optimizer trace is generated in html.
063:             *
064:             * @param onOrOff    Whether or not optimizer trace will be in html (true) or not (false).
065:             *
066:             * @return Whether or not the call was successful.  (false will be returned when optimizer tracing is not supported.)
067:             */
068:            public static boolean setOptimizerTraceHtml(boolean onOrOff) {
069:                boolean retCode = false;
070:
071:                try {
072:                    // Get the current language connection context.  This is associated
073:                    // with the current database.
074:                    LanguageConnectionContext lcc = ConnectionUtil
075:                            .getCurrentLCC();
076:                    retCode = lcc.setOptimizerTraceHtml(onOrOff);
077:                } catch (Throwable t) {
078:                    // eat all exceptions, simply return false
079:                }
080:
081:                return retCode;
082:            }
083:
084:            /**
085:             * Get the optimizer trace output for the last optimized query as a String.  If optimizer trace
086:             * html is on, then the String will contain the html tags.
087:             *
088:             * @return The optimizer trace output for the last optimized query as a String.
089:             *    Null will be returned if optimizer trace output is off or not supported 
090:             *    or no trace output was found or an exception occurred.
091:             */
092:            public static String getOptimizerTraceOutput() {
093:                String retCode = null;
094:
095:                try {
096:                    // Get the current language connection context.  This is associated
097:                    // with the current database.
098:                    LanguageConnectionContext lcc = ConnectionUtil
099:                            .getCurrentLCC();
100:                    retCode = lcc.getOptimizerTraceOutput();
101:                } catch (Throwable t) {
102:                    // eat all exceptions, simply return null
103:                }
104:
105:                return retCode;
106:            }
107:
108:            /**
109:             * Send the optimizer trace output for the last optimized query to a file with a .html extension.  
110:             * If optimizer trace html is on, then the output will contain the html tags.
111:             *
112:             * @param fileName    The name of the file to write to.  (.html extension will be added.)
113:             *
114:             * @return Whether or not the request was successful.
115:             *    false mayl be returned for a number of reasons, including if optimizer trace output is off or not supported 
116:             *    or no trace output was found or an exception occurred.
117:             */
118:            public static boolean writeOptimizerTraceOutputHtml(String fileName) {
119:                boolean retCode = true;
120:
121:                try {
122:                    String output = getOptimizerTraceOutput();
123:                    //RESOLVEOPTIMIZERTRACE - need to write out the html
124:                } catch (Throwable t) {
125:                    // eat all exceptions, simply return false
126:                    retCode = false;
127:                }
128:
129:                return retCode;
130:            }
131:
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.