Skip to content

Commit

Permalink
Get SQL type name from SqlOPCode column..
Browse files Browse the repository at this point in the history
  • Loading branch information
akardapolov committed Dec 29, 2017
1 parent 29ab95c commit 76b0845
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 68 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
apply plugin: 'application'
apply plugin: 'java'

version = '3.5.2'
version = '3.5.1'
sourceCompatibility = 1.5
targetCompatibility = 1.5

Expand Down
88 changes: 88 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0"?>
<project default="run" name="ASHV">
<description>
ASH Viewer build file
</description>

<property name="main.class" value="org.ash.MainApp"/>
<property name="jar.name" value="${ant.project.name}.jar"/>

<property name="src.dir" value="src"/>
<property name="build.dir" value="bin"/>
<property name="dist.dir" value="dist"/>
<property name="lib.dir" value="lib"/>

<path id="build.classpath">
<fileset dir="${lib.dir}">
<include name="**.jar"/>
</fileset>
</path>

<property name="build.classpath" refid="build.classpath"/>

<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>

<target name="compile" depends="clean">
<mkdir dir="${build.dir}"/>

<javac srcdir="${src.dir}"
destdir="${build.dir}"
debug="on"
deprecation="false"
source="1.5"
target="1.5"
classpath="${build.classpath}"
includeantruntime="false">
<include name="org/jfree/**"/>
<include name="org/ash/**"/>
<include name="ext/egantt/**"/>
<include name="com/egantt/**"/>
<exclude name="org/jfree/chart/xml/**"/>
<exclude name="org/jfree/chart/encoders/SunPNGEncoderAdapter.java" unless="ImageIO.present"/>
<exclude name="org/jfree/chart/encoders/SunJPEGEncoderAdapter.java" unless="ImageIO.present"/>
</javac>

<!-- copy across .properties files -->
<copy todir="${build.dir}/org/jfree/chart/">
<fileset dir="${src.dir}/org/jfree/chart">
<include name="*.properties" />
</fileset>
</copy>
<copy todir="${build.dir}/org/jfree/chart/plot">
<fileset dir="${src.dir}/org/jfree/chart/plot">
<include name="*.properties" />
</fileset>
</copy>
<copy todir="${build.dir}/org/jfree/chart/editor">
<fileset dir="${src.dir}/org/jfree/chart/editor">
<include name="*.properties" />
</fileset>
</copy>

</target>

<target name="jar" depends="compile">
<mkdir dir="${dist.dir}/${lib.dir}"/>
<copy todir="${dist.dir}/${lib.dir}">
<fileset dir="${lib.dir}"/>
</copy>

<manifestclasspath property="jar.classpath" jarfile="${jar.name}">
<classpath refid="build.classpath"/>
</manifestclasspath>

<jar basedir="${build.dir}" destfile="${dist.dir}/${jar.name}">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</jar>
</target>

<target name="run" depends="jar">
<java jar="${dist.dir}/${jar.name}" fork="true"/>
</target>
</project>
7 changes: 6 additions & 1 deletion src/org/ash/datatemp/SqlsTemp.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
*/
package org.ash.datatemp;

import org.ash.util.Options;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.ash.util.Options;

/**
* The Class SqlsTemp.
Expand Down Expand Up @@ -213,6 +214,10 @@ public List<Double> getSqlPlanHashValue(String sqlId){
List<Double> list = sqlHashValueHashMap.get(sqlId);
return list;
}

public void putSqlType(String sqlId, String sqlType){
mainSqls.get(sqlId).put(SQL_TYPE, sqlType);
}

/**
* Sets the time of group event.
Expand Down
11 changes: 6 additions & 5 deletions src/org/ash/history/ASHDatabaseH.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ public void calculateSqlsSessionsData(double beginTime, double endTime,
String useridS = useridL.toString().trim();
String programSess = ASH.getProgram();

Double sqlPlanHashValue = (Double) ASH.getSqlPlanHashValue();
Double sqlPlanHashValue = ASH.getSqlPlanHashValue();

String waitClass = ASH.getWaitClass();
String eventName = ASH.getEvent();
Expand All @@ -688,22 +688,22 @@ public void calculateSqlsSessionsData(double beginTime, double endTime,
this.loadDataToTempSqlSession(tmpSqlsTemp, tmpSessionsTemp,
sqlId, 0.0/*timeWaited*/, waitTime, 0.0/*waitClassId*/, sessionId, sessionidS,
sessionSerial, sessioniSerialS, useridL, useridS, programSess,
true, eventFlag, sqlPlanHashValue);
true, eventFlag, sqlPlanHashValue, String.valueOf(ASH.getSqlOPCode()));
}
} else {
if (waitClass != null && waitClass.equalsIgnoreCase(eventFlag)){
this.loadDataToTempSqlSession(tmpSqlsTemp, tmpSessionsTemp,
sqlId, timeWaited, 0.0/*waittime*/, waitClassId, sessionId, sessionidS,
sessionSerial, sessioniSerialS, useridL, useridS, programSess,
true, eventName, sqlPlanHashValue);
true, eventName, sqlPlanHashValue, String.valueOf(ASH.getSqlOPCode()));
}
}
} else {

this.loadDataToTempSqlSession(tmpSqlsTemp, tmpSessionsTemp,
sqlId, timeWaited, waitTime, waitClassId, sessionId, sessionidS,
sessionSerial, sessioniSerialS, useridL, useridS, programSess,
false, eventFlag, sqlPlanHashValue);
false, eventFlag, sqlPlanHashValue, String.valueOf(ASH.getSqlOPCode()));

}
}
Expand Down Expand Up @@ -790,7 +790,7 @@ private void loadDataToTempSqlSession(SqlsTemp tmpSqlsTemp, SessionsTemp tmpSess
String sqlId, double timeWaited, double waitTime,
double waitClassId, Long sessionId, String sessionidS, Double sessionSerial,
String sessioniSerialS, Long useridL, String useridS, String programSess,
boolean isDetail, String eventDetail, double sqlPlanHashValue){
boolean isDetail, String eventDetail, double sqlPlanHashValue, String sqlOpname){

int count = 1;

Expand All @@ -810,6 +810,7 @@ private void loadDataToTempSqlSession(SqlsTemp tmpSqlsTemp, SessionsTemp tmpSess
waitClassId,
count);

tmpSqlsTemp.putSqlType(sqlId, sqlOpname);
}

/** Save data for session row */
Expand Down
75 changes: 28 additions & 47 deletions src/org/ash/history/GanttH.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,64 +21,39 @@
*/
package org.ash.history;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import org.ash.conn.model.Model;
import org.ash.database.ASHDatabase;
import org.ash.database.Database10g2;
import org.ash.database.Database11g1;
import org.ash.database.Database11g2;
import org.ash.gui.ASHReport;
import org.ash.gui.ASHrawdata;
import org.ash.gui.GanttSplitPane;
import org.ash.gui.SqlPlan;
import org.ash.util.Options;
import org.ash.util.ProgressBarUtil;
import org.ash.util.Utils;
import org.syntax.jedit.JEditTextArea;
import com.egantt.model.drawing.ContextResources;
import com.egantt.model.drawing.DrawingState;
import com.egantt.model.drawing.part.ListDrawingPart;
import ext.egantt.model.drawing.state.BasicDrawingState;
import com.egantt.swing.cell.CellState;
import com.egantt.swing.component.ComponentResources;
import com.egantt.swing.component.context.BasicComponentContext;
import com.egantt.swing.component.tooltip.ToolTipState;
import com.egantt.swing.table.list.BasicJTableList;

import ext.egantt.drawing.module.BasicPainterModule;
import ext.egantt.drawing.module.GradientColorModule;
import ext.egantt.drawing.painter.context.BasicPainterContext;
import ext.egantt.model.drawing.state.BasicDrawingState;
import ext.egantt.swing.GanttDrawingPartHelper;
import ext.egantt.swing.GanttTable;
import org.ash.conn.model.Model;
import org.ash.database.ASHDatabase;
import org.ash.gui.ASHReport;
import org.ash.gui.ASHrawdata;
import org.ash.gui.GanttSplitPane;
import org.ash.util.Options;
import org.ash.util.ProgressBarUtil;
import org.ash.util.Utils;
import org.syntax.jedit.JEditTextArea;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.*;
import java.util.List;
import java.util.Map.Entry;

/**
* The Class GanttH (history).
Expand Down Expand Up @@ -172,6 +147,9 @@ public class GanttH extends JPanel{

/** SQL text */
private JEditTextArea jtextAreaSqlText = Options.getInstance().getJtextAreaSqlTextGanttH();

/** The SQL_TYPE. */
private String SQL_TYPE = "SQL_TYPE";

/**
* Constructor Gantt JPanel
Expand Down Expand Up @@ -533,8 +511,11 @@ private Object[][] loadDataToSqlsGantt(Map<Integer,String> arraySqlIdText50SQLTe
me,countOfSqls,sumOfRange);

data[i][1] = me.getKey();
data[i][2] = UNKNOWN;

//data[i][2] = UNKNOWN;
double value = Double.parseDouble((String) me.getValue().get(SQL_TYPE));
data[i][2] = Options.getInstance().getResource(
Options.getInstance().getResource(String.valueOf((int) value)));

/** Load sqlid */
arraySqlIdType50.put(me.getKey(),
database.getSqlType(me.getKey()));
Expand Down
29 changes: 15 additions & 14 deletions src/org/ash/history/detail/GanttSqls.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,17 @@
*/
package org.ash.history.detail;

import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import org.ash.history.ASHDatabaseH;
import org.ash.util.Utils;

import com.egantt.model.drawing.DrawingState;
import com.egantt.model.drawing.part.ListDrawingPart;
import ext.egantt.model.drawing.state.BasicDrawingState;

import ext.egantt.drawing.module.BasicPainterModule;
import ext.egantt.model.drawing.state.BasicDrawingState;
import ext.egantt.swing.GanttDrawingPartHelper;
import org.ash.history.ASHDatabaseH;
import org.ash.util.Options;
import org.ash.util.Utils;

import java.util.*;
import java.util.Map.Entry;

public class GanttSqls {

Expand All @@ -54,6 +49,9 @@ public class GanttSqls {

/** The UNKNOWN var. */
private String UNKNOWN = "UNKNOWN";

/** The SQL_TYPE. */
private String SQL_TYPE = "SQL_TYPE";

/** The scale toggle:
* < 30 => 2
Expand Down Expand Up @@ -121,8 +119,11 @@ private Object[][] loadDataToSqlsGanttPr(Map<Integer,String> arraySqlIdText50SQL
me,countOfSqls,sumOfRange);

data[i][1] = me.getKey();
data[i][2] = UNKNOWN;

//data[i][2] = UNKNOWN;
double value = Double.parseDouble((String) me.getValue().get(SQL_TYPE));
data[i][2] = Options.getInstance().getResource(
Options.getInstance().getResource(String.valueOf((int) value)));

/** Load sqlid */
arraySqlIdType50.put(me.getKey(),
database.getSqlType(me.getKey()));
Expand Down

0 comments on commit 76b0845

Please sign in to comment.