Source Code Cross Referenced for SQLExecutionInfo.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » client » session » 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 Client » squirrel sql 2.6.5a » net.sourceforge.squirrel_sql.client.session 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.client.session;
002:
003:        /*
004:         * Copyright (C) 2002-2004 Colin Bell
005:         * colbell@users.sourceforge.net
006:         *
007:         * Modifications Copyright (C) 2003-2004 Jason Height
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2.1 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022:         */
023:        import java.util.Calendar;
024:        import java.util.Date;
025:
026:        /**
027:         * Information about an executed query.
028:         *
029:         * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
030:         */
031:        public class SQLExecutionInfo {
032:            /** Query index. */
033:            private int _idx;
034:
035:            /** Execution start time. */
036:            private Date _sqlExecutionStart;
037:
038:            /** Results processing start time. */
039:            private Date _resultsProcessingStart;
040:
041:            /** Results processing end time. */
042:            private Date _resultsProcessingEnd;
043:
044:            /** SQL script executed. */
045:            private String _sql;
046:
047:            /** Number of rows query limited to. */
048:            private final int _maxRows;
049:
050:            /**
051:             * Default ctor. Defaults SQL execution start time to the current time.
052:             */
053:            //	public SQLExecutionInfo()
054:            //	{
055:            //		this(1, "");
056:            //	}
057:            /**
058:             * ctor specifying the query index. Defaults SQL execution start time to
059:             * the current time.
060:             *
061:             * @param	idx		Query index.
062:             */
063:            //	public SQLExecutionInfo(int idx)
064:            //	{
065:            //		this(idx, "");
066:            //	}
067:            /**
068:             * ctor specifying the SQL being executed. Defaults SQL execution start time
069:             * to the current time.
070:             *
071:             * @param	sql		SQL being executed.
072:             *
073:             * @throws	IllegalArgumentException
074:             * 			Thrown if <TT>null</TT> sql passed.
075:             */
076:            //	public SQLExecutionInfo(String sql)
077:            //	{
078:            //		super();
079:            //		if (sql == null)
080:            //		{
081:            //			throw new IllegalArgumentException("SQL script == null");
082:            //		}
083:            //		_sql = sql;
084:            //		_sqlExecutionStart = Calendar.getInstance().getTime();
085:            //	}
086:            /**
087:             * ctor specifying the SQL being executed and the query index. Defaults SQL
088:             * execution start time to the current time.
089:             *
090:             * @param	idx		Query index.
091:             * @param	sql		SQL being executed.
092:             * @param	maxRows	Number of rows query is limited to.
093:             *
094:             * @throws	IllegalArgumentException
095:             * 			Thrown if <TT>null</TT> sql passed.
096:             */
097:            public SQLExecutionInfo(int idx, String sql, int maxRows) {
098:                super ();
099:                if (sql == null) {
100:                    throw new IllegalArgumentException("SQL script == null");
101:                }
102:                _idx = idx;
103:                _sql = sql;
104:                _maxRows = maxRows;
105:                _sqlExecutionStart = Calendar.getInstance().getTime();
106:            }
107:
108:            /**
109:             * Flag that the SQL execution is complete.
110:             */
111:            public void sqlExecutionComplete() {
112:                _resultsProcessingStart = Calendar.getInstance().getTime();
113:            }
114:
115:            /**
116:             * Flag that the results processing is complete.
117:             */
118:            public void resultsProcessingComplete() {
119:                _resultsProcessingEnd = Calendar.getInstance().getTime();
120:            }
121:
122:            /**
123:             * Retrieve the query index.
124:             *
125:             * @return	Query index.
126:             */
127:            public int getQueryIndex() {
128:                return _idx;
129:            }
130:
131:            /**
132:             * Retrieve the SQL script executed.
133:             *
134:             * @return	SQL script executed.
135:             */
136:            public String getSQL() {
137:                return _sql;
138:            }
139:
140:            /**
141:             * Retrieve the SQL Execution start time.
142:             *
143:             * @return	SQL execution start time.
144:             */
145:            public Date getSQLExecutionStartTime() {
146:                return _sqlExecutionStart;
147:            }
148:
149:            /**
150:             * Set the SQL Execution start time.
151:             *
152:             * @param	value	SQL execution start time.
153:             *
154:             * @throws	IllegalArgumentException
155:             * 			Thrown if <TT>null</TT> <TT>Date</TT> passed.
156:             */
157:            public void setSQLExecutionStartTime(Date value) {
158:                if (value == null) {
159:                    throw new IllegalArgumentException(
160:                            "SQL Execution start time == null");
161:                }
162:                _sqlExecutionStart = value;
163:            }
164:
165:            /**
166:             * Retrieve the elapsed time time in milliseconds for the SQL execution.
167:             *
168:             * @return		SQL execution elapsed time in millis.
169:             */
170:            public long getSQLExecutionElapsedMillis() {
171:                long results = 0;
172:                if (_resultsProcessingStart != null) {
173:                    results = _resultsProcessingStart.getTime()
174:                            - _sqlExecutionStart.getTime();
175:                }
176:                return results;
177:            }
178:
179:            /**
180:             * Retrieve the elapsed time time in milliseconds for the results processing.
181:             *
182:             * @return		Results processing elapsed time in millis.
183:             */
184:            public long getResultsProcessingElapsedMillis() {
185:                long results = 0;
186:                if (_resultsProcessingEnd != null
187:                        && _resultsProcessingStart != null) {
188:                    results = (_resultsProcessingEnd.getTime() - _resultsProcessingStart
189:                            .getTime());
190:                }
191:                return results;
192:            }
193:
194:            /**
195:             * Retrieve the total elapsed time time in milliseconds.
196:             *
197:             * @return	Total elapsed time in millis.
198:             */
199:            public long getTotalElapsedMillis() {
200:                return getSQLExecutionElapsedMillis()
201:                        + getResultsProcessingElapsedMillis();
202:            }
203:
204:            /**
205:             * Retrieve number of rows query limited to. Zero means unlimited.
206:             *
207:             * @return	number of rows query limited to.
208:             */
209:            public int getMaxRows() {
210:                return _maxRows;
211:            }
212:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.