KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > odbc > TempColumnCharacteristics


1 package com.daffodilwoods.daffodildb.odbc;
2
3 import java.text.*;
4
5 import com.daffodilwoods.daffodildb.server.sql99.dql.resultsetmetadata.*;
6 import com.daffodilwoods.database.general.*;
7 import com.daffodilwoods.database.resource.*;
8 import com.daffodilwoods.database.utility.*;
9 import com.daffodilwoods.daffodildb.server.datadictionarysystem._ColumnCharacteristics;
10
11 /* 1. CatalogName
12  * 2. SchemaName
13  * 3. TableName
14  * 4. ColumnName
15  * 5. ColumnType
16  * 6. ColumnLabel
17  * 7. Precision
18  * 8. Scale
19  * 9. isAutoIncrement
20  * 10. isNullable
21  * 11. ByteSize
22  */

23
24 public class TempColumnCharacteristics implements _SelectColumnCharacteristics, _RowReader {
25    Object JavaDoc[][] columnCharacteristics;
26    String JavaDoc[] columns;
27    public TempColumnCharacteristics(Object JavaDoc[][] columnCharacteristics0, String JavaDoc[] columns0) {
28       this.columnCharacteristics = columnCharacteristics0;
29       this.columns = columns0;
30    }
31
32    public boolean isColumnUpdatable(int parm1) throws DException {
33       return false;
34    }
35
36    public boolean isUpdatable() throws DException {
37       return false;
38    }
39
40    public boolean isColumnSelectable(int parm1) throws DException {
41       return true;
42    }
43
44    public _SelectColumnCharacteristics getColumnCharacteristics(int parm1) throws
45        DException {
46       return this;
47    }
48
49    public boolean isForeignTableRecordFetched(int parm1) throws DException {
50       return false;
51    }
52
53    public int getColumnType(int parm1) throws DException {
54       int column = getValidColumn(parm1);
55       return columnCharacteristics[column][4].hashCode();
56    }
57
58    public String JavaDoc getColumnName(int parm1) throws DException {
59       int column = getValidColumn(parm1);
60       return (String JavaDoc) columnCharacteristics[column][3];
61    }
62
63    public String JavaDoc getRelatedTable(int parm1) throws DatabaseException, DException {
64       return null;
65    }
66
67    public int getColumnCount() throws DException {
68       return columnCharacteristics.length;
69    }
70
71    public int getSize(int parm1) throws DException {
72       int column = getValidColumn(parm1);
73       return columnCharacteristics[column][10].hashCode();
74    }
75
76    public String JavaDoc getTableName(int parm1) throws DatabaseException, DException {
77       int column = getValidColumn(parm1);
78       return (String JavaDoc) columnCharacteristics[column][2];
79    }
80
81    public int getPrecision(int parm1) throws DException {
82       int column = getValidColumn(parm1);
83       return columnCharacteristics[column][6].hashCode();
84    }
85
86    public int getScale(int parm1) throws DException {
87       int column = getValidColumn(parm1);
88       return columnCharacteristics[column][7].hashCode();
89    }
90
91    public String JavaDoc getSchemaName(int parm1) throws DException {
92       int column = getValidColumn(parm1);
93       return (String JavaDoc) columnCharacteristics[column][1];
94    }
95
96    public String JavaDoc getCatalogName(int parm1) throws DException {
97       int column = getValidColumn(parm1);
98       return (String JavaDoc) columnCharacteristics[column][0];
99    }
100
101    public int isNullable(int parm1) throws DException {
102       int column = getValidColumn(parm1);
103       return columnCharacteristics[column][9].hashCode();
104    }
105
106    public boolean isAutoIncrement(int parm1) throws DException {
107       return false;
108    }
109
110    public String JavaDoc getColumnLabel(int parm1) throws DException {
111       int column = getValidColumn(parm1);
112       return (String JavaDoc) columnCharacteristics[column][5];
113    }
114
115    public String JavaDoc[] getRelatedColumns(int parm1) throws DatabaseException,
116        DException {
117       return null;
118    }
119
120    public Collator getCollator() throws DException {
121       return null;
122    }
123
124
125    public int getColumnIndex(String JavaDoc parm1) throws DException {
126       int index = P.indexOfIgnoreCase(columns, parm1);
127       if (index == -1)
128          throw new DException("DSEClient column {0} not found",
129                               new Object JavaDoc[] {parm1});
130       return index + 1;
131    }
132
133    public String JavaDoc[] getColumnNames() throws DException {
134       return this.columns;
135    }
136
137    public int[] getColumnIndexes(String JavaDoc[] parm1) throws DException {
138       int len = parm1.length;
139       int[] columnIndexes = new int[len];
140       for (int i = 0; i < len; i++) {
141          columnIndexes[i] = getColumnIndex(parm1[i]);
142       }
143       return columnIndexes;
144    }
145
146
147    public Object JavaDoc getObject(int int0, Object JavaDoc object) throws DException {
148       int columnIndex = getValidColumn(int0);
149       return object == null ? null : ( (Object JavaDoc[]) object)[columnIndex];
150    }
151
152    public void setObject(int int0, Object JavaDoc object, Object JavaDoc object2) throws DException {
153       throw new java.lang.UnsupportedOperationException JavaDoc(
154           "Method setObject() not yet implemented.");
155    }
156
157    private int getValidColumn(int column) throws DException {
158       if (columnCharacteristics == null || column < 1 ||
159           column > columnCharacteristics.length) {
160          DException dex = new DException("DSE737", null);
161          throw dex;
162       }
163       return column - 1;
164    }
165
166    /************************ Not Required ***********************************/
167
168    public String JavaDoc getExpression(int parm1) throws DException {
169       throw new java.lang.UnsupportedOperationException JavaDoc(
170           "Method getExpression() not yet implemented.");
171    }
172
173    public Object JavaDoc[] getCorresspondingColumnsForFromSubQueryColumn(
174        Object JavaDoc parm1) throws DException {
175       throw new java.lang.UnsupportedOperationException JavaDoc(
176           "Method getCorresspondingColumnsForFromSubQueryColumn() not yet implemented.");
177    }
178
179    public String JavaDoc[] getPrimaryKeys() throws DatabaseException, DException {
180       throw new java.lang.UnsupportedOperationException JavaDoc(
181           "Method getPrimaryKeys() not yet implemented.");
182    }
183
184    public String JavaDoc getRelation(int parm1) throws DatabaseException, DException {
185       throw new java.lang.UnsupportedOperationException JavaDoc(
186           "Method getRelation() not yet implemented.");
187    }
188
189    public int[] getPrimaryConditionColumns() throws DException {
190       throw new java.lang.UnsupportedOperationException JavaDoc(
191           "Method getPrimaryConditionColumns() not yet implemented.");
192    }
193
194    public String JavaDoc getQualifiedTableName(int parm1) throws DException {
195       throw new java.lang.UnsupportedOperationException JavaDoc(
196           "Method getQualifiedTableName() not yet implemented.");
197    }
198
199    public short getTableType() throws DException {
200       throw new java.lang.UnsupportedOperationException JavaDoc(
201           "Method getTableType() not yet implemented.");
202    }
203
204    public _ColumnCharacteristics getCCFromIndexes(_ColumnCharacteristics cc, int offset, int[] columnIndexes) throws DException {
205       throw new UnsupportedOperationException JavaDoc("getCCFromIndexes(cc, offset, columnIndexes) method not implemented yet");
206    }
207 }
208
Popular Tags