[Isql-devevelopment] SF.net SVN: isql: [86] isql-core/branches/3.1.0-development
Brought to you by:
mkobold
From: <mk...@us...> - 2007-08-08 01:14:32
|
Revision: 86 http://isql.svn.sourceforge.net/isql/?rev=86&view=rev Author: mkobold Date: 2007-08-07 18:14:34 -0700 (Tue, 07 Aug 2007) Log Message: ----------- * merged with the 3.0.2 Modified Paths: -------------- isql-core/branches/3.1.0-development/.classpath isql-core/branches/3.1.0-development/.externalToolBuilders/External Resource Copier.launch isql-core/branches/3.1.0-development/.project isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/ResultSetRenderer.java isql-core/branches/3.1.0-development/src/org/isqlviewer/util/IsqlToolkit.java isql-core/branches/3.1.0-development/src/org/isqlviewer/util/NullResultSetViewer.java isql-core/branches/3.1.0-development/src/org/isqlviewer/util/QueryExecutor.java Added Paths: ----------- isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/QueryMetadata.java Modified: isql-core/branches/3.1.0-development/.classpath =================================================================== --- isql-core/branches/3.1.0-development/.classpath 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/.classpath 2007-08-08 01:14:34 UTC (rev 86) @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="test"/> - <classpathentry exported="true" kind="var" path="JUNIT_HOME/junit.jar" sourcepath="/JUNIT_SRC_HOME/junitsrc.zip"/> <classpathentry exported="true" kind="lib" path="lib/log4j.jar"/> <classpathentry exported="true" kind="lib" path="lib/derby.jar"/> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: isql-core/branches/3.1.0-development/.externalToolBuilders/External Resource Copier.launch =================================================================== --- isql-core/branches/3.1.0-development/.externalToolBuilders/External Resource Copier.launch 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/.externalToolBuilders/External Resource Copier.launch 2007-08-08 01:14:34 UTC (rev 86) @@ -1,15 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> -<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> -<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="eclipse-setup,"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,"/> +<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="eclipse-setup,"/> <booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/isql-core}"/> +<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> <booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> +<listEntry value="/isql-core/build.xml"/> +</listAttribute> +<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> +<listEntry value="1"/> +</listAttribute> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> +<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/isql-core/build.xml}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/isql-core}"/> </launchConfiguration> Modified: isql-core/branches/3.1.0-development/.project =================================================================== --- isql-core/branches/3.1.0-development/.project 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/.project 2007-08-08 01:14:34 UTC (rev 86) @@ -12,7 +12,7 @@ </buildCommand> <buildCommand> <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> - <triggers>full,</triggers> + <triggers>full,incremental,</triggers> <arguments> <dictionary> <key>LaunchConfigHandle</key> Copied: isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/QueryMetadata.java (from rev 84, isql-core/branches/3.0.0-maintenance/src/org/isqlviewer/sql/QueryMetadata.java) =================================================================== --- isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/QueryMetadata.java (rev 0) +++ isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/QueryMetadata.java 2007-08-08 01:14:34 UTC (rev 86) @@ -0,0 +1,87 @@ +/* + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * + * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool. + * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved. + * + * Contributor(s): + * Mark A. Kobold [mkobold <at> isqlviewer <dot> com]. + * + * If you didn't download this code from the following link, you should check + * if you aren't using an obsolete version: http://www.isqlviewer.com + */ +package org.isqlviewer.sql; + +import org.isqlviewer.history.HistoricalCommand; + +/** + * Simple meta-data object for collecting query execution metrics within iSQL-Viewer. + * <p> + * + * @author Mark A. Kobold <mkobold at isqlviewer dot com> + * @version 1.0 + */ +public class QueryMetadata { + + private long userTime = 0; + private String service = null; + private HistoricalCommand command = null; + + /** + * @return the command + */ + public HistoricalCommand getCommand() { + + return command; + } + + /** + * @param command the command to set + */ + public void setCommand(HistoricalCommand command) { + + this.command = command; + } + + /** + * @return the service + */ + public String getService() { + + return service; + } + + /** + * @param service the service to set + */ + public void setService(String service) { + + this.service = service; + } + + /** + * @return the userTime + */ + public long getUserTime() { + + return userTime; + } + + /** + * @param userTime the userTime to set + */ + public void setUserTime(long userTime) { + + this.userTime = userTime; + } +} Modified: isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/ResultSetRenderer.java =================================================================== --- isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/src/org/isqlviewer/sql/ResultSetRenderer.java 2007-08-08 01:14:34 UTC (rev 86) @@ -177,7 +177,7 @@ * * @param stmtID unqiue identifier for the statement that was cancelled. */ - public void finalizeStatement(String stmtID); + public void finalizeStatement(String stmtID, QueryMetadata metaData); /** * Statement warnings from a resultset can be delegated here. Modified: isql-core/branches/3.1.0-development/src/org/isqlviewer/util/IsqlToolkit.java =================================================================== --- isql-core/branches/3.1.0-development/src/org/isqlviewer/util/IsqlToolkit.java 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/src/org/isqlviewer/util/IsqlToolkit.java 2007-08-08 01:14:34 UTC (rev 86) @@ -69,7 +69,7 @@ * Build number or patch level version of the iSQL-Viewer code base. * <p> */ - public static final int VERSION_BUILD = 0; + public static final int VERSION_BUILD = 2; /** * System property for determining if the iSQL-Viewer MRJ Adapter is installed. */ Modified: isql-core/branches/3.1.0-development/src/org/isqlviewer/util/NullResultSetViewer.java =================================================================== --- isql-core/branches/3.1.0-development/src/org/isqlviewer/util/NullResultSetViewer.java 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/src/org/isqlviewer/util/NullResultSetViewer.java 2007-08-08 01:14:34 UTC (rev 86) @@ -27,6 +27,7 @@ import java.sql.SQLWarning; import java.sql.Statement; +import org.isqlviewer.sql.QueryMetadata; import org.isqlviewer.sql.ResultSetRenderer; class NullResultSetViewer implements ResultSetRenderer { @@ -39,7 +40,7 @@ } - public void finalizeStatement(String stmtID) { + public void finalizeStatement(String stmtID, QueryMetadata metaData) { } Modified: isql-core/branches/3.1.0-development/src/org/isqlviewer/util/QueryExecutor.java =================================================================== --- isql-core/branches/3.1.0-development/src/org/isqlviewer/util/QueryExecutor.java 2007-08-08 01:14:18 UTC (rev 85) +++ isql-core/branches/3.1.0-development/src/org/isqlviewer/util/QueryExecutor.java 2007-08-08 01:14:34 UTC (rev 86) @@ -46,6 +46,7 @@ import org.isqlviewer.sql.ConnectionProfile; import org.isqlviewer.sql.JdbcService; import org.isqlviewer.sql.JdbcUtilities; +import org.isqlviewer.sql.QueryMetadata; import org.isqlviewer.sql.ResultSetRenderer; /** @@ -68,6 +69,7 @@ private ResultSetRenderer renderer = null; private String statement = null; private JdbcService service = null; + private boolean logHistory = true; public QueryExecutor(JdbcService service, ResultSetRenderer renderer, String statement) { @@ -80,6 +82,11 @@ this.statement = statement; } + public void setLogHistory(boolean logHistory) { + + this.logHistory = logHistory; + } + public void run() { if (service == null) { @@ -111,13 +118,17 @@ boolean logBatch = statements.length > 1; for (int i = 0; i < statements.length; i++) { String userQuery = statements[i].trim(); + QueryMetadata metadata = new QueryMetadata(); + metadata.setService(service.getName()); if (userQuery.length() > 0) { try { renderer.initialize(); String substitutedQuery = doVariableSubstitutions(userQuery); String nativeSQL = getNativeSql(connection, substitutedQuery); Date queryTime = new Date(); + long userTime = System.currentTimeMillis(); doQuery(connection, localID, nativeSQL); + metadata.setUserTime(System.currentTimeMillis() - userTime); if (logBatch && commandLogger != null) { HistoricalCommand subCommand = new HistoricalCommand(); subCommand.setCommandText(userQuery); @@ -126,8 +137,9 @@ subCommand.setTransactionId(executionHistory.getTransactionId()); getTypeForQuery(subCommand, userQuery); executionHistory.addSubcommand(subCommand); + metadata.setCommand(subCommand); } else { - logCommandHistory(commandLogger, userQuery, queryTime); + metadata.setCommand(logCommandHistory(commandLogger, userQuery, queryTime)); } } catch (ParseException e) { error("ERR:", e); @@ -141,12 +153,14 @@ } catch (Exception e) { error("ERR:", e); } finally { - renderer.finalizeStatement(localID); + renderer.finalizeStatement(localID, metadata); } } } - if (commandLogger != null && logBatch) { - commandLogger.logCommand(executionHistory); + if (logHistory) { + if (commandLogger != null && logBatch) { + commandLogger.logCommand(executionHistory); + } } } finally { info(messages.getMessage("queryexecutor.finished")); @@ -155,16 +169,18 @@ } - private void logCommandHistory(JdbcCommandLogger commandLogger, String userQuery, Date queryTime) { + private HistoricalCommand logCommandHistory(JdbcCommandLogger commandLogger, String userQuery, Date queryTime) { - if (commandLogger != null) { + if (logHistory && commandLogger != null) { HistoricalCommand command = new HistoricalCommand(); command.setCommandText(userQuery); command.setQueryTime(queryTime); command.setService(service.getName()); getTypeForQuery(command, userQuery); commandLogger.logCommand(command); + return command; } + return null; } private void getTypeForQuery(HistoricalCommand command, String userQuery) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |