View Javadoc

1   package salto.tool.sql.data;
2   
3   import java.sql.ResultSet;
4   import java.sql.SQLException;
5   import java.sql.Types;
6   
7   /***
8    * @version 	1.0
9    * @author
10   */
11  public class TypeInfo {
12      
13      /***
14       * Nom du type (retourné par la base de donnée)
15       */
16      private String typeName;
17      /***
18       * @see Types
19       */
20      private short dataTyp;
21      /***
22       * maximum precision
23       */
24      private int precision;
25      /***
26       * prefix used to quote a literal 
27       */
28      private String literalPrefix;
29      /***
30       * suffix used to quote a literal 
31       */
32      private String literalsuffix;
33      /***
34       * parameters used in creating the type
35       */
36      private String createParams;
37      /***
38       *      can you use NULL for this type.
39       *      <UL>
40       *      <LI> typeNoNulls - does not allow NULL values
41       *      <LI> typeNullable - allows NULL values
42       *      <LI> typeNullableUnknown - nullability unknown
43       *      </UL>
44  	*/
45      private short nullable;
46      /***
47       * is it case sensitive.
48       */
49      private boolean caseSensitive;
50      /***
51       * can you use "WHERE" based on this type:
52       *      <UL>
53       *      <LI> typePredNone - No support
54       *      <LI> typePredChar - Only supported with WHERE .. LIKE
55       *      <LI> typePredBasic - Supported except for WHERE .. LIKE
56       *      <LI> typeSearchable - Supported for all WHERE ..
57       *      </UL>
58       */
59      private short searchable;
60      /***
61       * is it unsigned.
62       */
63      private boolean unsignedAttribute;
64      /***
65       * can it be a money value.
66       */
67      private boolean fixedPrecScale;
68      /***
69       * can it be used for an auto-increment value.
70       */
71      private boolean autoIncrement;
72      /***
73       * localized version of type name 
74       */
75      private String localTypeName;
76      /***
77       * minimum scale supported
78       */
79      private short minimumScale;
80      /***
81       * maximum scale supported
82       */
83      private short maximumScale;
84      /***
85       * unused
86       */
87      private int sqlDataTyp;
88      /***
89       * unused
90       */
91      private int sqlDateTimeSub;
92      /***
93       * usually 2 or 10
94       */
95      private int numPrecRadix;
96      
97      /***
98       * Constructor for TypeInfo.
99       */
100     public TypeInfo(ResultSet rs) {
101 		try {typeName = rs.getString(1);} catch (SQLException e) {}
102 		try {dataTyp = rs.getShort(2);} catch (SQLException e) {}
103 		try {precision = rs.getInt(3);} catch (SQLException e) {}
104 		try {literalPrefix = rs.getString(4);} catch (SQLException e) {}
105 		try {literalsuffix = rs.getString(5);} catch (SQLException e) {}
106 		try {createParams = rs.getString(6);} catch (SQLException e) {}
107 		try {nullable = rs.getShort(7);} catch (SQLException e) {}
108 		try {caseSensitive = rs.getBoolean(8);} catch (SQLException e) {}
109 		try {searchable = rs.getShort(9);} catch (SQLException e) {}
110 		try {unsignedAttribute = rs.getBoolean(10);} catch (SQLException e) {}
111 		try {fixedPrecScale = rs.getBoolean(11);} catch (SQLException e) {}
112 		try {autoIncrement = rs.getBoolean(12);} catch (SQLException e) {}
113 		try {localTypeName = rs.getString(13);} catch (SQLException e) {}
114 		try {minimumScale = rs.getShort(14);} catch (SQLException e) {}
115 		try {maximumScale = rs.getShort(15);} catch (SQLException e) {}
116 		try {sqlDataTyp = rs.getInt(16);} catch (SQLException e) {}
117 		try {sqlDateTimeSub = rs.getInt(17);} catch (SQLException e) {}
118 		try {numPrecRadix = rs.getInt(18);} catch (SQLException e) {}
119     }
120 
121     /***
122      * Gets the literalPrefix.
123      * @return Returns a String
124      */
125     public String getLiteralPrefix() {
126         return literalPrefix;
127     }
128 
129     /***
130      * Sets the literalPrefix.
131      * @param literalPrefix The literalPrefix to set
132      */
133     public void setLiteralPrefix(String literalPrefix) {
134         this.literalPrefix = literalPrefix;
135     }
136 
137     /***
138      * Gets the literalsuffix.
139      * @return Returns a String
140      */
141     public String getLiteralsuffix() {
142         return literalsuffix;
143     }
144 
145     /***
146      * Sets the literalsuffix.
147      * @param literalsuffix The literalsuffix to set
148      */
149     public void setLiteralsuffix(String literalsuffix) {
150         this.literalsuffix = literalsuffix;
151     }
152 
153     /***
154      * Gets the localTypeName.
155      * @return Returns a String
156      */
157     public String getLocalTypeName() {
158         return localTypeName;
159     }
160 
161     /***
162      * Sets the localTypeName.
163      * @param localTypeName The localTypeName to set
164      */
165     public void setLocalTypeName(String localTypeName) {
166         this.localTypeName = localTypeName;
167     }
168 
169     /***
170      * Gets the maximumScale.
171      * @return Returns a short
172      */
173     public short getMaximumScale() {
174         return maximumScale;
175     }
176 
177     /***
178      * Sets the maximumScale.
179      * @param maximumScale The maximumScale to set
180      */
181     public void setMaximumScale(short maximumScale) {
182         this.maximumScale = maximumScale;
183     }
184 
185     /***
186      * Gets the minimumScale.
187      * @return Returns a short
188      */
189     public short getMinimumScale() {
190         return minimumScale;
191     }
192 
193     /***
194      * Sets the minimumScale.
195      * @param minimumScale The minimumScale to set
196      */
197     public void setMinimumScale(short minimumScale) {
198         this.minimumScale = minimumScale;
199     }
200 
201     /***
202      * Gets the nullable.
203      * @return Returns a short
204      */
205     public short getNullable() {
206         return nullable;
207     }
208 
209     /***
210      * Sets the nullable.
211      * @param nullable The nullable to set
212      */
213     public void setNullable(short nullable) {
214         this.nullable = nullable;
215     }
216 
217     /***
218      * Gets the numPrecRadix.
219      * @return Returns a int
220      */
221     public int getNumPrecRadix() {
222         return numPrecRadix;
223     }
224 
225     /***
226      * Sets the numPrecRadix.
227      * @param numPrecRadix The numPrecRadix to set
228      */
229     public void setNumPrecRadix(int numPrecRadix) {
230         this.numPrecRadix = numPrecRadix;
231     }
232 
233     /***
234      * Gets the precision.
235      * @return Returns a int
236      */
237     public int getPrecision() {
238         return precision;
239     }
240 
241     /***
242      * Sets the precision.
243      * @param precision The precision to set
244      */
245     public void setPrecision(int precision) {
246         this.precision = precision;
247     }
248 
249     /***
250      * Gets the searchable.
251      * @return Returns a short
252      */
253     public short getSearchable() {
254         return searchable;
255     }
256 
257     /***
258      * Sets the searchable.
259      * @param searchable The searchable to set
260      */
261     public void setSearchable(short searchable) {
262         this.searchable = searchable;
263     }
264 
265     /***
266      * Gets the sqlDataTyp.
267      * @return Returns a int
268      */
269     public int getSqlDataTyp() {
270         return sqlDataTyp;
271     }
272 
273     /***
274      * Sets the sqlDataTyp.
275      * @param sqlDataTyp The sqlDataTyp to set
276      */
277     public void setSqlDataTyp(int sqlDataTyp) {
278         this.sqlDataTyp = sqlDataTyp;
279     }
280 
281     /***
282      * Gets the autoIncrement.
283      * @return Returns a boolean
284      */
285     public boolean getAutoIncrement() {
286         return autoIncrement;
287     }
288 
289     /***
290      * Sets the autoIncrement.
291      * @param autoIncrement The autoIncrement to set
292      */
293     public void setAutoIncrement(boolean autoIncrement) {
294         this.autoIncrement = autoIncrement;
295     }
296 
297     /***
298      * Gets the caseSensitive.
299      * @return Returns a boolean
300      */
301     public boolean getCaseSensitive() {
302         return caseSensitive;
303     }
304 
305     /***
306      * Sets the caseSensitive.
307      * @param caseSensitive The caseSensitive to set
308      */
309     public void setCaseSensitive(boolean caseSensitive) {
310         this.caseSensitive = caseSensitive;
311     }
312 
313     /***
314      * Gets the createParams.
315      * @return Returns a String
316      */
317     public String getCreateParams() {
318         return createParams;
319     }
320 
321     /***
322      * Sets the createParams.
323      * @param createParams The createParams to set
324      */
325     public void setCreateParams(String createParams) {
326         this.createParams = createParams;
327     }
328 
329     /***
330      * Gets the dataTyp.
331      * @return Returns a short
332      */
333     public short getDataTyp() {
334         return dataTyp;
335     }
336 
337     /***
338      * Sets the dataTyp.
339      * @param dataTyp The dataTyp to set
340      */
341     public void setDataTyp(short dataTyp) {
342         this.dataTyp = dataTyp;
343     }
344 
345     /***
346      * Gets the ixedPrecScale.
347      * @return Returns a boolean
348      */
349     public boolean getIxedPrecScale() {
350         return fixedPrecScale;
351     }
352 
353     /***
354      * Sets the ixedPrecScale.
355      * @param ixedPrecScale The ixedPrecScale to set
356      */
357     public void setIxedPrecScale(boolean ixedPrecScale) {
358         fixedPrecScale = ixedPrecScale;
359     }
360 
361     /***
362      * Gets the sqlDateTimeSub.
363      * @return Returns a int
364      */
365     public int getSqlDateTimeSub() {
366         return sqlDateTimeSub;
367     }
368 
369     /***
370      * Sets the sqlDateTimeSub.
371      * @param sqlDateTimeSub The sqlDateTimeSub to set
372      */
373     public void setSqlDateTimeSub(int sqlDateTimeSub) {
374         this.sqlDateTimeSub = sqlDateTimeSub;
375     }
376 
377     /***
378      * Gets the typeName.
379      * @return Returns a String
380      */
381     public String getTypeName() {
382         return typeName;
383     }
384 
385     /***
386      * Sets the typeName.
387      * @param typeName The typeName to set
388      */
389     public void setTypeName(String typeName) {
390         this.typeName = typeName;
391     }
392 
393     /***
394      * Gets the unsignedAttribute.
395      * @return Returns a boolean
396      */
397     public boolean getUnsignedAttribute() {
398         return unsignedAttribute;
399     }
400 
401     /***
402      * Sets the unsignedAttribute.
403      * @param unsignedAttribute The unsignedAttribute to set
404      */
405     public void setUnsignedAttribute(boolean unsignedAttribute) {
406         this.unsignedAttribute = unsignedAttribute;
407     }
408 
409 }