001: //
002: // Copyright 1998 CDS Networks, Inc., Medford Oregon
003: //
004: // All rights reserved.
005: //
006: // Redistribution and use in source and binary forms, with or without
007: // modification, are permitted provided that the following conditions are met:
008: // 1. Redistributions of source code must retain the above copyright
009: // notice, this list of conditions and the following disclaimer.
010: // 2. Redistributions in binary form must reproduce the above copyright
011: // notice, this list of conditions and the following disclaimer in the
012: // documentation and/or other materials provided with the distribution.
013: // 3. All advertising materials mentioning features or use of this software
014: // must display the following acknowledgement:
015: // This product includes software developed by CDS Networks, Inc.
016: // 4. The name of CDS Networks, Inc. may not be used to endorse or promote
017: // products derived from this software without specific prior
018: // written permission.
019: //
020: // THIS SOFTWARE IS PROVIDED BY CDS NETWORKS, INC. ``AS IS'' AND
021: // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
022: // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
023: // ARE DISCLAIMED. IN NO EVENT SHALL CDS NETWORKS, INC. BE LIABLE
024: // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
025: // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
026: // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
027: // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
028: // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
029: // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
030: // SUCH DAMAGE.
031: //
032:
033: package com.internetcds.jdbc.tds;
034:
035: import java.sql.ResultSetMetaData;
036:
037: public class Column {
038: public static final String cvsVersion = "$Id: Column.java,v 1.2 2007-10-19 13:21:40 sinisa Exp $";
039:
040: private String name;
041: private boolean haveName = false;
042: private int displaySize;
043: private boolean haveDisplaySize = false;
044: private String label;
045: private boolean haveLabel = false;
046: private int type;
047: private boolean haveType = false;
048: private int precision;
049: private boolean havePrecision = false;
050: private int scale;
051: private boolean haveScale = false;
052: private boolean readOnly = false;
053: private boolean readOnlySet = false;
054: private boolean autoIncrement = false;
055: private boolean autoIncrementSet = false;
056: private int nullable = java.sql.ResultSetMetaData.columnNullableUnknown;
057:
058: public Column() {
059: name = null;
060: displaySize = -1;
061: label = null;
062: type = -1;
063: precision = -1;
064: scale = -1;
065: }
066:
067: public void setName(String value) {
068: name = value;
069: haveName = true;
070: }
071:
072: public String getName() {
073: return name;
074: }
075:
076: public void setDisplaySize(int value) {
077: displaySize = value;
078: haveDisplaySize = true;
079: }
080:
081: public int getDisplaySize() {
082: return displaySize;
083: }
084:
085: public void setLabel(String value) {
086: label = value;
087: haveLabel = true;
088: }
089:
090: public String getLabel() {
091: return label;
092: }
093:
094: public void setType(int value) {
095: // don't convert from
096: type = value;
097: haveType = true;
098: }
099:
100: public int getType() {
101: return type;
102: }
103:
104: public void setPrecision(int value) {
105: precision = value;
106: havePrecision = true;
107: }
108:
109: public int getPrecision() {
110: return precision;
111: }
112:
113: public void setScale(int value) {
114: scale = value;
115: haveScale = true;
116: }
117:
118: public int getScale() {
119: return scale;
120: }
121:
122: public boolean isAutoIncrement() {
123: return autoIncrement;
124: }
125:
126: public void setAutoIncrement(boolean flag) {
127: autoIncrementSet = true;
128: autoIncrement = flag;
129: }
130:
131: public boolean autoIncrementWasSet() {
132: return autoIncrementSet;
133: }
134:
135: public int isNullable() {
136: return nullable;
137: }
138:
139: public void setNullable(int flag) {
140: nullable = flag;
141: }
142:
143: public boolean isReadOnly() {
144: return readOnly;
145: }
146:
147: public void setReadOnly(boolean flag) {
148: readOnlySet = true;
149: readOnly = flag;
150: }
151:
152: public boolean readOnlyWasSet() {
153: return readOnlySet;
154: }
155: }
|