}
return 0;
}
+
+ public int getTableItemCount(String tableName, String option) {
+ String query = null;
+ Statement stat = null;
+ ResultSet rs = null;
+ Connection conn = null;
+ try {
+ conn = getConnection();
+ if (null == conn) {
+ return 0;
+ }
+ semaphoreAcquire();
+ if (null == tableName || tableName.length() < 1) {
+ System.out.println("tableName is null");
+ return 0;
+ }
+ String optionQuery = CommonConstants.EMPTY;
+ if (null != option) {
+ optionQuery = "where " + option;//$NON-NLS-1$
+ }
+
+ query = String.format("select max(rid) from %s %s",//$NON-NLS-1$
+ tableName, optionQuery);
+
+ stat = conn.createStatement();
+
+ rs = stat.executeQuery(query);
+ if (null == rs) {
+ return 0;
+ }
+
+ while (rs.next()) {
+ return rs.getInt(1);
+ }
+ } catch (SQLException e) {
+ do {
+ System.out.println("query: " + query);
+ System.out.println("Message: " + e.getMessage());
+ System.out.println("SQL state: " + e.getSQLState());
+ System.out.println("Vendor code: " + e.getErrorCode());
+ e.printStackTrace();
+ } while ((e = e.getNextException()) != null);
+ } finally {
+ AnalyzerUtil.tryClose(stat, rs);
+ if (null != conn) {
+ semaphoreRelease();
+ }
+ }
+ return 0;
+ }
}
}
protected int getItemCount() {
- return LogDataFactory.getProfilingLogNum();
+ if (AnalyzerManager.isRunning()) { // trace
+ setDbInsetedItemCount(LogDataFactory.getProfilingLogNum());
+ } else {
+ if (getDbInsetedItemCount() == 0) { // open
+ setDbInsetedItemCount(SqlManager.getInstance()
+ .getTableItemCount(getDBTableName(), dbOptionQuery));
+ } else if (LogDataFactory.getProfilingLogNum() > 0) { // stop
+ setDbInsetedItemCount(LogDataFactory.getProfilingLogNum());
+ }
+ }
+ return getDbInsetedItemCount();
}
public void setSelectionByTime(long startTime, long endTime) {
private int preLogCount = -1;
private int preSelectionScrollIndex = -1;
List<LogData> savedLogDataList = null;
-
+ private int dbInsetedItemCount = 0;
+
protected Color rangeColor = ColorResources.TABLE_RANGE_COLOR_RANGE;
protected Color secondSelectionColor = ColorResources.TABLE_RANGE_COLOR_SECOND_SELECTION;
protected Color intersectColor = ColorResources.TABLE_RANGE_COLOR_RANGE_SECOND;
preDBTableItemsCount = 0;
savedTableInputList = null;
savedLogDataList = null;
+ dbInsetedItemCount = 0;
}
private List<TableInput> makeTableInput() {
private void setSavedDBList(List<TableInput> savedDBList) {
this.savedTableInputList = savedDBList;
}
+
+ public int getDbInsetedItemCount() {
+ return dbInsetedItemCount;
+ }
+
+ public void setDbInsetedItemCount(int dbInsetedItemCount) {
+ this.dbInsetedItemCount = dbInsetedItemCount;
+ }
}