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 sequence.
29: *
30: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
31: */
32: public class SequenceDetailsTab extends BasePreparedStatementTab {
33: private static final StringManager s_stringMgr = StringManagerFactory
34: .getStringManager(SequenceDetailsTab.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.sequenceDetails=Details]
42: String TITLE = s_stringMgr.getString("oracle.sequenceDetails");
43: // i18n[oracle.displaysSequenceDetails=Display sequence details]
44: String HINT = s_stringMgr
45: .getString("oracle.displaysSequenceDetails");
46: }
47:
48: /** SQL that retrieves the data. */
49: private static final String SQL = "select sequence_name, min_value, max_value, increment_by, cycle_flag,"
50: + " order_flag, cache_size, last_number"
51: + " from all_sequences"
52: + " where sequence_owner = ?"
53: + " and sequence_name = ?";
54:
55: public SequenceDetailsTab() {
56: super (i18n.TITLE, i18n.HINT, true);
57: }
58:
59: protected PreparedStatement createStatement() throws SQLException {
60: ISession session = getSession();
61: PreparedStatement pstmt = session.getSQLConnection()
62: .prepareStatement(SQL);
63: IDatabaseObjectInfo doi = getDatabaseObjectInfo();
64: pstmt.setString(1, doi.getSchemaName());
65: pstmt.setString(2, doi.getSimpleName());
66: return pstmt;
67: }
68: }
|