01: /*
02: * IgnoredCommand.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.sql.commands;
13:
14: import java.sql.SQLException;
15:
16: import workbench.resource.ResourceMgr;
17: import workbench.sql.SqlCommand;
18: import workbench.sql.StatementRunnerResult;
19:
20: /**
21: * This class simply ignores the command and does not send it to the DBMS
22: *
23: * Thus scripts e.g. intended for SQL*Plus (containing WHENEVER or EXIT)
24: * can be executed from within the workbench.
25: * The commands to be ignored can be configured in workbench.settings
26: *
27: * @author support@sql-workbench.net
28: */
29: public class IgnoredCommand extends SqlCommand {
30: private String verb;
31:
32: public IgnoredCommand(String aVerb) {
33: this .verb = aVerb;
34: }
35:
36: public StatementRunnerResult execute(String aSql)
37: throws SQLException {
38: StatementRunnerResult result = new StatementRunnerResult();
39: String msg = ResourceMgr.getString("MsgCommandIgnored")
40: .replaceAll("%verb%", this .verb);
41: result.addMessage(msg);
42: result.setSuccess();
43: this .done();
44: return result;
45: }
46:
47: public String getVerb() {
48: return verb;
49: }
50:
51: }
|