001: package net.sourceforge.squirrel_sql.fw.sql;
002:
003: /*
004: * Copyright (C) 2002-2003 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: public class TableColumnInfo extends DatabaseObjectInfo {
022: static final long serialVersionUID = 3529392685978921375L;
023:
024: private final String _tableName;
025: private final String _columnName;
026: private final int _dataType;
027: private final String _typeName;
028: private final int _columnSize;
029: private final int _decimalDigits;
030: private final int _radix;
031: private final int _isNullAllowed;
032: private final String _remarks;
033: private final String _defaultValue;
034: private final int _octetLength;
035: private final int _ordinalPosition;
036: private final String _isNullable;
037:
038: public TableColumnInfo(String catalog, String schema,
039: String tableName, String columnName, int dataType,
040: String typeName, int columnSize, int decimalDigits,
041: int radix, int isNullAllowed, String remarks,
042: String defaultValue, int octetLength, int ordinalPosition,
043: String isNullable, ISQLDatabaseMetaData md) {
044: super (catalog, schema, tableName + '.' + columnName,
045: DatabaseObjectType.COLUMN, md);
046: _tableName = tableName;
047: _columnName = columnName;
048: _dataType = dataType;
049: _typeName = typeName;
050: _columnSize = columnSize;
051: _decimalDigits = decimalDigits;
052: _radix = radix;
053: _isNullAllowed = isNullAllowed;
054: _remarks = remarks;
055: _defaultValue = defaultValue;
056: _octetLength = octetLength;
057: _ordinalPosition = ordinalPosition;
058: _isNullable = isNullable;
059: }
060:
061: public TableColumnInfo(String catalog, String schema,
062: String tableName, String columnName, int dataType,
063: String typeName, int columnSize, int decimalDigits,
064: int radix, int isNullAllowed, String remarks,
065: String defaultValue, int octetLength, int ordinalPosition,
066: String isNullable) {
067: super (catalog, schema, tableName);
068: _tableName = tableName;
069: _columnName = columnName;
070: _dataType = dataType;
071: _typeName = typeName;
072: _columnSize = columnSize;
073: _decimalDigits = decimalDigits;
074: _radix = radix;
075: _isNullAllowed = isNullAllowed;
076: _remarks = remarks;
077: _defaultValue = defaultValue;
078: _octetLength = octetLength;
079: _ordinalPosition = ordinalPosition;
080: _isNullable = isNullable;
081: }
082:
083: public String getTableName() {
084: return _tableName;
085: }
086:
087: public String getColumnName() {
088: return _columnName;
089: }
090:
091: public int getDataType() {
092: return _dataType;
093: }
094:
095: public String getTypeName() {
096: return _typeName;
097: }
098:
099: public int getColumnSize() {
100: return _columnSize;
101: }
102:
103: public int getDecimalDigits() {
104: return _decimalDigits;
105: }
106:
107: public int getRadix() {
108: return _radix;
109: }
110:
111: public int isNullAllowed() {
112: return _isNullAllowed;
113: }
114:
115: public String getRemarks() {
116: return _remarks;
117: }
118:
119: public String getDefaultValue() {
120: return _defaultValue;
121: }
122:
123: public int getOctetLength() {
124: return _octetLength;
125: }
126:
127: public int getOrdinalPosition() {
128: return _ordinalPosition;
129: }
130:
131: public String isNullable() {
132: return _isNullable;
133: }
134:
135: /*
136: protected String generateQualifiedName(SQLDatabaseMetaData md)
137: {
138: String identifierQuoteString = null;
139: try
140: {
141: identifierQuoteString = md.getIdentifierQuoteString();
142: if (identifierQuoteString != null
143: && identifierQuoteString.equals(" "))
144: {
145: identifierQuoteString = null;
146: }
147: }
148: catch (SQLException ignore)
149: {
150: }
151:
152: StringBuffer buf = new StringBuffer(super.generateQualifiedName(md));
153: buf.append('.');
154: if (identifierQuoteString != null)
155: {
156: buf.append(identifierQuoteString);
157: }
158: buf.append(_columnName);
159: if (identifierQuoteString != null)
160: {
161: buf.append(identifierQuoteString);
162: }
163: setSimpleName(_columnName);
164:
165: return buf.toString();
166: }
167: */
168: }
|