01: package net.sourceforge.squirrel_sql.plugins.oracle.tab;
02:
03: /*
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: import java.sql.PreparedStatement;
19: import java.sql.SQLException;
20:
21: import net.sourceforge.squirrel_sql.client.session.ISession;
22: import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.BasePreparedStatementTab;
23: import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
24: import net.sourceforge.squirrel_sql.fw.util.StringManager;
25: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
26:
27: /**
28: * This class will display the details for an Oracle index.
29: *
30: * @author <A HREF="mailto:jmheight@users.sourceforge.net">Jason Height</A>
31: */
32: public class IndexDetailsTab extends BasePreparedStatementTab {
33: private static final StringManager s_stringMgr = StringManagerFactory
34: .getStringManager(IndexDetailsTab.class);
35:
36: /**
37: * This interface defines locale specific strings. This should be
38: * replaced with a property file.
39: */
40: private interface i18n {
41: // i18n[oracle.details=Details]
42: String TITLE = s_stringMgr.getString("oracle.details");
43: // i18n[oracle.displayDetails=Display index details]
44: String HINT = s_stringMgr.getString("oracle.displayDetails");
45: }
46:
47: /** SQL that retrieves the data. */
48: private static final String SQL = "select index_type, tablespace_name, table_owner, table_name, table_type, uniqueness"
49: + " compression, initial_extent, next_extent, min_extents, max_extents,"
50: + " pct_increase, pct_threshold, status, num_rows, last_analyzed"
51: + " from sys.all_indexes where owner = ?"
52: + " and index_name = ?";
53:
54: public IndexDetailsTab() {
55: super (i18n.TITLE, i18n.HINT, true);
56: }
57:
58: protected PreparedStatement createStatement() throws SQLException {
59: ISession session = getSession();
60: PreparedStatement pstmt = session.getSQLConnection()
61: .prepareStatement(SQL);
62: IDatabaseObjectInfo doi = getDatabaseObjectInfo();
63: pstmt.setString(1, doi.getSchemaName());
64: pstmt.setString(2, doi.getSimpleName());
65: return pstmt;
66: }
67: }
|