org.firebirdsql.squirrel.act.AlterIndexCommand Maven / Gradle / Ivy
package org.firebirdsql.squirrel.act;
import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
import net.sourceforge.squirrel_sql.client.session.ISession;
/**
* This command will run an "ALTER INDEX" over the
* currently selected indices.
*
* @author Colin Bell
*/
class AlterIndexCommand extends AbstractMultipleSQLCommand
{
private final boolean _activate;
/**
* Ctor.
*
* @throws IllegalArgumentException
* Thrown if a null ISession,
* Resources or IPlugin passed.
* @param activate true to activate the index else false
*/
public AlterIndexCommand(ISession session, IPlugin plugin, boolean activate)
{
super(session, plugin);
_activate = activate;
}
/**
* Retrieve the SQL to run.
*
* @param dbObj The index to run the command over.
*
* @return the SQL to run.
*/
protected String getSQL(IDatabaseObjectInfo dbObj)
{
return "ALTER INDEX " + dbObj.getQualifiedName() + (_activate ? " ACTIVE" : " INACTIVE");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy