001: /*
002: * Copyright (C) 2004 Gerd Wagner
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package net.sourceforge.squirrel_sql.client.session;
020:
021: import net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo;
022:
023: import java.io.Serializable;
024:
025: public class ExtendedColumnInfo implements Serializable {
026: private static final long serialVersionUID = 1L;
027: private String _columnName;
028: private String _columnType;
029: private int _columnSize;
030: private int _decimalDigits;
031: private boolean _nullable;
032: private String _cat;
033: private String _schem;
034: private String _simpleTableName;
035: private String _qualifiedName;
036:
037: public ExtendedColumnInfo(TableColumnInfo info,
038: String simpleTableName) {
039: _columnName = info.getColumnName();
040: _columnType = info.getTypeName();
041: _columnSize = info.getColumnSize();
042: _decimalDigits = info.getDecimalDigits();
043: if ("YES".equals(info.isNullable())) {
044: _nullable = true;
045: } else {
046: _nullable = false;
047: }
048: _cat = info.getCatalogName();
049: _schem = info.getSchemaName();
050: _simpleTableName = simpleTableName;
051:
052: _qualifiedName = _cat + "." + _schem + "." + _simpleTableName
053: + "." + _columnName;
054: }
055:
056: public String getColumnName() {
057: return _columnName;
058: }
059:
060: public String getColumnType() {
061: return _columnType;
062: }
063:
064: public int getColumnSize() {
065: return _columnSize;
066: }
067:
068: public int getDecimalDigits() {
069: return _decimalDigits;
070: }
071:
072: public boolean isNullable() {
073: return _nullable;
074: }
075:
076: public String getCatalog() {
077: return _cat;
078: }
079:
080: public String getSchema() {
081: return _schem;
082: }
083:
084: public String getSimpleTableName() {
085: return _simpleTableName;
086: }
087:
088: /**
089: * @see java.lang.Object#hashCode()
090: */
091: @Override
092: public int hashCode() {
093: final int prime = 31;
094: int result = 1;
095: result = prime
096: * result
097: + ((_qualifiedName == null) ? 0 : _qualifiedName
098: .hashCode());
099: return result;
100: }
101:
102: /**
103: * @see java.lang.Object#equals(java.lang.Object)
104: */
105: @Override
106: public boolean equals(Object obj) {
107: if (this == obj)
108: return true;
109: if (obj == null)
110: return false;
111: if (getClass() != obj.getClass())
112: return false;
113: final ExtendedColumnInfo other = (ExtendedColumnInfo) obj;
114: if (_qualifiedName == null) {
115: if (other._qualifiedName != null)
116: return false;
117: } else if (!_qualifiedName.equals(other._qualifiedName))
118: return false;
119: return true;
120: }
121: }
|