01: package net.sourceforge.squirrel_sql.plugins.oracle.tab;
02:
03: import java.sql.PreparedStatement;
04: import java.sql.SQLException;
05:
06: import net.sourceforge.squirrel_sql.client.session.ISession;
07: import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
08: import net.sourceforge.squirrel_sql.fw.util.StringManager;
09: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
10:
11: public class SnapshotSourceTab extends OracleSourceTab {
12: private static final StringManager s_stringMgr = StringManagerFactory
13: .getStringManager(SnapshotSourceTab.class);
14:
15: /** SQL that retrieves the data. */
16: private static final String SQL = "SELECT 'CREATE MATERIALIZED VIEW ' || TABLE_NAME || ' AS ', QUERY "
17: + "FROM SYS.ALL_SNAPSHOTS "
18: + "WHERE OWNER = ? AND TABLE_NAME = ? ";
19:
20: public SnapshotSourceTab() {
21: // i18n[oracle.displaySnapshotDetails=Display materialized view details]
22: super (s_stringMgr.getString("oracle.displaySnapshotDetails"));
23: super .sourceType = OracleSourceTab.TABLE_TYPE;
24: }
25:
26: protected PreparedStatement createStatement() throws SQLException {
27: ISession session = getSession();
28: PreparedStatement pstmt = session.getSQLConnection()
29: .prepareStatement(SQL);
30: IDatabaseObjectInfo doi = getDatabaseObjectInfo();
31: pstmt.setString(1, doi.getSchemaName());
32: pstmt.setString(2, doi.getSimpleName());
33: return pstmt;
34: }
35: }
|