1 | public class SequenceDetailsTab extends BasePreparedStatementTab↵ | | 1 | public class SessionStatisticsTab extends BasePreparedStatementTab↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final StringManager s_stringMgr =↵ | | 3 | private static final StringManager s_stringMgr =↵
|
4 | StringManagerFactory.getStringManager(SequenceDetailsTab.class);↵ | | 4 | StringManagerFactory.getStringManager(SessionStatisticsTab.class);↵
|
|
|
5 | /**↵ | | 5 | /**↵
|
6 | * This interface defines locale specific strings. This should be↵ | | 6 | * This interface defines locale specific strings. This should be↵
|
7 | * replaced with a property file.↵ | | 7 | * replaced with a property file.↵
|
8 | */↵ | | 8 | */↵
|
9 | private interface i18n↵ | | 9 | private interface i18n↵
|
10 | {↵ | | 10 | {↵
|
11 | // i18n[oracle.sequenceDetails=Details]↵ | | 11 | // i18n[oracle.sessionStatistics=Session Statistics]↵
|
12 | String TITLE = s_stringMgr.getString("oracle.sequenceDetails");↵ | | 12 | String TITLE = s_stringMgr.getString("oracle.sessionStatistics");↵
|
13 | // i18n[oracle.displaysSequenceDetails=Display sequence details]↵ | | 13 | // i18n[oracle.displaySessionStatistics=Display database session statistics]↵
|
14 | String HINT = s_stringMgr.getString("oracle.displaysSequenceDetails");↵ | | 14 | String HINT = s_stringMgr.getString("oracle.displaySessionStatistics");↵
|
15 | }↵ | | 15 | }↵
|
|
16 | /** SQL that retrieves the data. */↵ | | 16 | /** SQL that retrieves the data. */↵
|
17 | private static final String SQL =↵ | | 17 | private static String SQL =↵
|
18 | "select sequence_name, min_value, max_value, increment_by, cycle_flag,"↵ | | 18 | "select sn.name, ss.value↵
|
19 | + " order_flag, cache_size, last_number"↵ | | |
|
20 | + " from all_sequences↵ | | 19 | "↵
|
21 | "↵ | | 20 | + " from sys.v_$sesstat ss, sys.v_$statname sn"↵
|
22 | + " where sequence_owner = ?"↵ | | 21 | + " where ss.sid = ?"↵
|
23 | + " and sequence_name = ?";↵ | | 22 | + " and ss.statistic# = sn.statistic#";↵
|
|
24 | public SequenceDetailsTab()↵ | | 23 | public SessionStatisticsTab()↵
|
25 | {↵ | | 24 | {↵
|
26 | super(i18n.TITLE, i18n.HINT, true);↵ | | 25 | super(i18n.TITLE, i18n.HINT);↵
|
27 | }↵ | | 26 | }↵
|
|
28 | protected PreparedStatement createStatement() throws SQLException↵ | | 27 | protected PreparedStatement createStatement() throws SQLException↵
|
29 | {↵ | | 28 | {↵
|
30 | ISession session = getSession();↵ | | 29 | ISession session = getSession();↵
|
31 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(SQL);↵ | | 30 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(SQL);↵
|
32 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | 31 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
33 | pstmt.setString(1, doi.getSchemaName());↵ | | 32 | String[] parts = doi.getSimpleName()↵
|
34 | ↵ | | 33 | .split("\\s+");↵
|
35 | pstmt.setString(2, doi.getSimpleName());↵ | | 34 | pstmt.setLong(1, Long.parseLong(parts[0]));↵
|
36 | return pstmt | | 35 | return pstmt
|