1 | public class GeneratorDetailsTab extends BasePreparedStatementTab↵ | | 1 | public class IndexColumnInfoTab extends BasePreparedStatementTab↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final StringManager s_stringMgr =↵ | | 3 | private static final StringManager s_stringMgr =↵
|
4 | StringManagerFactory.getStringManager(GeneratorDetailsTab.class);↵ | | 4 | StringManagerFactory.getStringManager(IndexColumnInfoTab.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[firebird.genDetails=Details]↵ | | 11 | // i18n[oracle.columns=Columns]↵
|
12 | String TITLE = s_stringMgr.getString("firebird.genDetails");↵ | | 12 | String TITLE = s_stringMgr.getString("↵
|
13 | // i18n[firebird.seqDetails=Display sequence details↵ | | 13 | oracle.columns");↵
|
14 | ]↵ | | 14 | // i18n[oracle.displayColumns=Display index column information]↵
|
15 | String HINT = s_stringMgr.getString("firebird.seqDetails");↵ | | 15 | String HINT = s_stringMgr.getString("↵
|
16 | }↵ | | |
|
|
17 | /** Logger for this class↵ | | 16 | oracle.displayColumns");↵
|
| | | 17 | }↵
|
|
18 | . */↵ | | 18 | /** SQL that retrieves the data. */↵
|
19 | private final static ILogger s_log =↵ | | 19 | private static ↵
|
20 | LoggerController.createLogger(GeneratorDetailsTab.class);↵ | | |
|
|
21 | public GeneratorDetails↵ | | 20 | String SQL =↵
|
| | | 21 | "select table_name, column_name, column_length, decode(descend, \'Y\', \'DESC\', \'ASC\')"↵
|
| | | 22 | + " from sys.all_ind_columns where index_owner = ?"↵
|
| | | 23 | + " and index_name = ?"↵
|
| | | 24 | + " order by column_position";↵
|
|
22 | Tab()↵ | | 25 | public IndexColumnInfoTab()↵
|
23 | {↵ | | 26 | {↵
|
24 | super(i18n.TITLE, i18n.HINT, true);↵ | | 27 | super(i18n.TITLE, i18n.HINT);↵
|
25 | }↵ | | 28 | }↵
|
|
26 | protected PreparedStatement createStatement() throws SQLException↵ | | 29 | protected PreparedStatement createStatement() throws SQLException↵
|
27 | {↵ | | 30 | {↵
|
28 | ISession session = getSession();↵ | | 31 | ISession session = getSession();↵
|
29 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵ | | |
|
30 | ↵ | | |
|
31 | String sql = "SELECT CAST('" + doi.getSimpleName() + "' AS VARCHAR(31)) as generator_name, " +↵ | | |
|
32 | "gen_id(" +↵ | | 32 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(SQL);↵
|
| | | 33 | IDatabaseObjectInfo doi = getDatabaseObjectInfo();↵
|
33 | doi.getSimpleName() + ", 0) as current_value " +↵ | | 34 | pstmt.setString(1, doi.getSchemaName()↵
|
34 | "from rdb$database";↵ | | |
|
35 | ↵ | | |
|
36 | if (s_log.isDebugEnabled()) {↵ | | |
|
37 | s_log.debug("Preparing SQL: "+sql);↵ | | |
|
38 | }↵ | | |
|
39 | PreparedStatement pstmt = session.getSQLConnection().prepareStatement(sql↵ | | 35 | );↵
|
40 | );↵ | | 36 | pstmt.setString(2, doi.getSimpleName());↵
|
41 | return pstmt | | 37 | return pstmt
|