01: /*
02: * WbListPkDef.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.wbcommands;
13:
14: import java.sql.SQLException;
15: import workbench.resource.ResourceMgr;
16: import workbench.sql.SqlCommand;
17: import workbench.sql.StatementRunnerResult;
18: import workbench.storage.PkMapping;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public class WbListPkDef extends SqlCommand {
25: public static final String VERB = "WBLISTPKDEF";
26: public static final String FORMATTED_VERB = "WblistPkDef";
27:
28: public WbListPkDef() {
29: }
30:
31: public String getVerb() {
32: return VERB;
33: }
34:
35: protected boolean isConnectionRequired() {
36: return false;
37: }
38:
39: public StatementRunnerResult execute(String aSql)
40: throws SQLException {
41: StatementRunnerResult result = new StatementRunnerResult();
42:
43: result.setSuccess();
44:
45: String info = PkMapping.getInstance().getMappingAsText();
46: if (info != null) {
47: result
48: .addMessage(ResourceMgr
49: .getString("MsgPkDefinitions"));
50: result.addMessage("");
51: result.addMessage(info);
52: result.addMessage(ResourceMgr
53: .getString("MsgPkDefinitionsEnd"));
54: } else {
55: result.addMessage(ResourceMgr
56: .getString("MsgPkDefinitionsEmpty"));
57: }
58: return result;
59: }
60: }
|