KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > internetcds > jdbc > tds > Column


1 //
2
// Copyright 1998 CDS Networks, Inc., Medford Oregon
3
//
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without
7
// modification, are permitted provided that the following conditions are met:
8
// 1. Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// 2. Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// 3. All advertising materials mentioning features or use of this software
14
// must display the following acknowledgement:
15
// This product includes software developed by CDS Networks, Inc.
16
// 4. The name of CDS Networks, Inc. may not be used to endorse or promote
17
// products derived from this software without specific prior
18
// written permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY CDS NETWORKS, INC. ``AS IS'' AND
21
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
// ARE DISCLAIMED. IN NO EVENT SHALL CDS NETWORKS, INC. BE LIABLE
24
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
// SUCH DAMAGE.
31
//
32

33
34
35 package com.internetcds.jdbc.tds;
36
37 import java.sql.ResultSetMetaData JavaDoc;
38
39
40 public class Column
41 {
42    public static final String JavaDoc cvsVersion = "$Id: Column.java,v 1.1 2006/06/23 10:39:04 sinisa Exp $";
43
44
45    private String JavaDoc name;
46    private boolean haveName = false;
47    private int displaySize;
48    private boolean haveDisplaySize = false;
49    private String JavaDoc label;
50    private boolean haveLabel = false;
51    private int type;
52    private boolean haveType = false;
53    private int precision;
54    private boolean havePrecision = false;
55    private int scale;
56    private boolean haveScale = false;
57    private boolean readOnly = false;
58    private boolean readOnlySet = false;
59    private boolean autoIncrement = false;
60    private boolean autoIncrementSet = false;
61    private int nullable = java.sql.ResultSetMetaData.columnNullableUnknown;
62
63    public Column()
64    {
65       name = null;
66       displaySize = -1;
67       label = null;
68       type = -1;
69       precision = -1;
70       scale = -1;
71    }
72
73    public void setName(String JavaDoc value)
74    {
75       name = value;
76       haveName = true;
77    }
78
79    public String JavaDoc getName()
80    {
81       return name;
82    }
83
84    public void setDisplaySize(int value)
85    {
86       displaySize = value;
87       haveDisplaySize = true;
88    }
89
90    public int getDisplaySize()
91    {
92       return displaySize;
93    }
94
95    public void setLabel(String JavaDoc value)
96    {
97       label = value;
98       haveLabel = true;
99    }
100
101    public String JavaDoc getLabel()
102    {
103       return label;
104    }
105
106    public void setType(int value)
107    {
108       // don't convert from
109
type = value;
110       haveType = true;
111    }
112
113    public int getType()
114    {
115       return type;
116    }
117    
118    public void setPrecision(int value)
119    {
120       precision = value;
121       havePrecision = true;
122    }
123    
124    public int getPrecision()
125    {
126       return precision;
127    }
128    
129    public void setScale(int value)
130    {
131       scale = value;
132       haveScale = true;
133    }
134    
135    public int getScale()
136    {
137       return scale;
138    }
139    
140    public boolean isAutoIncrement ()
141    {
142       return autoIncrement;
143    }
144    
145    public void setAutoIncrement (boolean flag)
146    {
147       autoIncrementSet = true;
148       autoIncrement = flag;
149    }
150    
151    public boolean autoIncrementWasSet()
152    {
153       return autoIncrementSet;
154    }
155
156    
157    public int isNullable ()
158    {
159       return nullable;
160    }
161    
162    public void setNullable (int flag)
163    {
164       nullable = flag;
165    }
166    
167    public boolean isReadOnly ()
168    {
169       return readOnly;
170    }
171    
172    public void setReadOnly (boolean flag)
173    {
174       readOnlySet = true;
175       readOnly = flag;
176    }
177
178    public boolean readOnlyWasSet()
179    {
180       return readOnlySet;
181    }
182 }
183
Popular Tags