01: package net.sourceforge.squirrel_sql.fw.sql;
02:
03: /*
04: * Copyright (C) 2001 Colin Bell
05: * colbell@users.sourceforge.net
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21: import java.sql.DatabaseMetaData;
22:
23: import net.sourceforge.squirrel_sql.fw.util.StringManager;
24: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
25:
26: public class ProcedureInfo extends DatabaseObjectInfo implements
27: IProcedureInfo {
28: static final long serialVersionUID = -4111528608716386156L;
29:
30: /** Internationalized strings for this class. */
31: private static final StringManager s_stringMgr = StringManagerFactory
32: .getStringManager(ProcedureInfo.class);
33:
34: private interface IStrings {
35: String DATABASE = s_stringMgr
36: .getString("ProcedureInfo.database");
37: String MAY_RETURN = s_stringMgr
38: .getString("ProcedureInfo.mayreturn");
39: String DOESNT_RETURN = s_stringMgr
40: .getString("ProcedureInfo.doesntreturn");
41: String DOES_RETURN = s_stringMgr
42: .getString("ProcedureInfo.returns");
43: String UNKNOWN = s_stringMgr.getString("ProcedureInfo.unknown");
44: }
45:
46: /** Procedure Type. */
47: private final int _procType;
48:
49: /** Procedure remarks. */
50: private final String _remarks;
51:
52: public ProcedureInfo(String catalog, String schema,
53: String simpleName, String remarks, int procType,
54: SQLDatabaseMetaData md) {
55: super (catalog, schema, simpleName,
56: DatabaseObjectType.PROCEDURE, md);
57: _remarks = remarks;
58: _procType = procType;
59: }
60:
61: public int getProcedureType() {
62: return _procType;
63: }
64:
65: public String getRemarks() {
66: return _remarks;
67: }
68:
69: public String getProcedureTypeDescription() {
70: switch (_procType) {
71: case DatabaseMetaData.procedureNoResult:
72: return IStrings.DOESNT_RETURN;
73: case DatabaseMetaData.procedureReturnsResult:
74: return IStrings.DOES_RETURN;
75: case DatabaseMetaData.procedureResultUnknown:
76: return IStrings.MAY_RETURN;
77: default:
78: return IStrings.UNKNOWN;
79: }
80: }
81:
82: public boolean equals(Object obj) {
83: if (super .equals(obj) && obj instanceof ProcedureInfo) {
84: ProcedureInfo info = (ProcedureInfo) obj;
85: if ((info._remarks == null && _remarks == null)
86: || ((info._remarks != null && _remarks != null) && info._remarks
87: .equals(_remarks))) {
88: return info._procType == _procType;
89: }
90: }
91: return false;
92: }
93:
94: }
|