01: package org.firebirdsql.squirrel.act;
02:
03: import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
04:
05: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
06: import net.sourceforge.squirrel_sql.client.session.ISession;
07:
08: /**
09: * This command will run an "ALTER INDEX" over the
10: * currently selected indices.
11: *
12: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
13: */
14: class AlterIndexCommand extends AbstractMultipleSQLCommand {
15: private final boolean _activate;
16:
17: /**
18: * Ctor.
19: *
20: * @throws IllegalArgumentException
21: * Thrown if a <TT>null</TT> <TT>ISession</TT>,
22: * <TT>Resources</TT> or <TT>IPlugin</TT> passed.
23: * @param activate <tt>true</tt> to activate the index else <tt>false</tt>
24: */
25: public AlterIndexCommand(ISession session, IPlugin plugin,
26: boolean activate) {
27: super (session, plugin);
28: _activate = activate;
29: }
30:
31: /**
32: * Retrieve the SQL to run.
33: *
34: * @param dbObj The index to run the command over.
35: *
36: * @return the SQL to run.
37: */
38: protected String getSQL(IDatabaseObjectInfo dbObj) {
39: return "ALTER INDEX " + dbObj.getQualifiedName()
40: + (_activate ? " ACTIVE" : " INACTIVE");
41: }
42: }
|