1 | /* |
2 | |
3 | Derby - Class org.apache.derby.client.net.Typdef |
4 | |
5 | Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.client.net; |
22 | |
23 | import org.apache.derby.iapi.reference.DRDAConstants; |
24 | import org.apache.derby.iapi.reference.JDBC30Translation; |
25 | import org.apache.derby.client.am.Cursor; |
26 | import org.apache.derby.client.am.DisconnectException; |
27 | import org.apache.derby.client.am.SignedBinary; |
28 | import org.apache.derby.client.am.ClientMessageId; |
29 | import org.apache.derby.shared.common.reference.SQLState; |
30 | |
31 | // |
32 | // General Notes |
33 | // Descriptors are overriden using two distinct mechanisms |
34 | // - new TYPDEFNAM and TYPDEFOVR specifications which override environmental |
35 | // specifications originally established at connect time. |
36 | // - MDD/SDA pairs providing specific field level overrides for user data |
37 | // not conforming to the TYPDEFNAM and TYPDEFOVR specifications currently |
38 | // in effect. Grouping triplets then refer to the new SDAs to specify |
39 | // the actual representation of the user data. |
40 | // - There are two types of early descriptor triplets, the T and the M triplets. |
41 | // Early |
42 | // --------------------------- |
43 | // Environmental Grp Row Arr |
44 | // TTTTTTTTTTTTT MMMMMMMMMMM |
45 | // - The T triplets are established by the TYPDEFNAM and TYPDEFOVR values. |
46 | // These can be overridden for any command or reply by specifying |
47 | // a new value for TYPDEFNAM and TYPDEFOVR. |
48 | // - The M triplets are established by the MGRLVL parameter on EXCSAT. |
49 | // They define PROTOCOL information units such as the SQLCA. |
50 | // These grouping and structuring triplets cannot be overriden |
51 | // Any change would mean a change in what information was exchanged |
52 | // rather than just how that information would be represented. |
53 | // - There are two types of late descriptor triplets, the O and U triplets. |
54 | // Late |
55 | // --------------------------- |
56 | // Environmental Grp Row Arr |
57 | // OOOOOOOOOOOOO UUUUUUUUUUU |
58 | // - The O triplets provide specific overrides. |
59 | // - The U triplets define actual user data, sometimes in combination |
60 | // with PROTOCOL information units. The U triplets reference O triplets |
61 | // and both T triplets and M triplets (which in turn reference T triplets). |
62 | // - Rules for assigning LIDs to O triplets |
63 | // - select LID within range of 1 to 255. |
64 | // - select LID which doesn't interfere with references to early triplets |
65 | // or O triplets. |
66 | // |
67 | // requirements |
68 | // - if this object handles overrides, they are only in effect for one |
69 | // command or the reply to one command. Make sure that the correct |
70 | // "in effect" overrides are used especially when MDD overrides are present. |
71 | // - raise error if no CCSIDMBC or CCSIDDBC has been specified for mixed or |
72 | // double byte data. Return SQLSTATE 57017 with 0 as source CCSID token. |
73 | // Possible errors: |
74 | // - check for valid lid at SQLAM level. |
75 | // - if the lid is greater than the max |
76 | // supported lid then the descriptor is invalid for the supported SQLAM level. |
77 | // Error Checking and Reporting Notes taken from PROTOCOL manual. |
78 | // - If the receiver of an FDODSC finds it in error, the error must |
79 | // be reported with a DDM message DSCINVRM. If the descriptor |
80 | // passes PROTOCOL validity checks, but the data does not match the |
81 | // descriptors, the mismatch must be reported with a DDM message DTAMCHRM. |
82 | // so descriptor must be correct and valid and then the data must match |
83 | // the descriptor. |
84 | // - Possible General Errors |
85 | // - 01 FD:OCA Triplet not used in PROTOCOL descriptors or Type code invalid. |
86 | // - 02 Triplet Sequence Error: the two possible sequences are: |
87 | // 1.) GDA,(CPT,)RLO<,RLO><== normal case with no overrrides |
88 | // 2.) MDD,SDA,(MDD,SDA,)MDD,GDA,(CPT,)\ |
89 | // MDD,RLO<,MDD,RLO> |
90 | // where () indicates an optional repeating group and <> indicates |
91 | // a field allowed only when arrays are expected. |
92 | // - 03 An array description is required, and this one does not |
93 | // describe an array (probably too many or too few RLO triplets). |
94 | // - 04 A row description is required, and this one does not describe a row |
95 | // probably too many or too few RLO triplets. |
96 | // - 05 Late Environmental Descriptor just received not supported (probably |
97 | // due to non-support of requested overrides). |
98 | // - 06 Malformed triplet; missing required parameter. |
99 | // - 07 Parameter value not acceptable. |
100 | // - Possible MDD Errors |
101 | // - 11 MDD present is not recognized as PROTOCOL Descriptor |
102 | // - 12 MDD class not recognized as valid PROTOCOL class. |
103 | // - 13 MDD type not recognized as valid PROTOCOL type. |
104 | // - Possible SDA Errors |
105 | // - 21 Representation incompatible with PROTOCOL type (in prior MDD). |
106 | // - 22 CCSID not supported |
107 | // - Possible GDA/CPT Errors |
108 | // - 32 GDA references a LID that is not an SDA or GDA. |
109 | // - 33 GDA length override exceeds limits. |
110 | // - 34 GDA precision exceeds limits. |
111 | // - 35 GDA scale > precision or scale negative |
112 | // - 36 GDA length override missing or incompatible with protocol type. |
113 | // - Possible RLO Errors |
114 | // - 41 RLO references a LID that is not an RLO or GDA |
115 | // - 42 RLO fails to reference a required GDA or RLO (for example, QRYDSC |
116 | // must include a reference to SQLCAGRP). |
117 | // |
118 | // Nullable SQL and PROTOCOL types are all odd numbers and nullable type is |
119 | // one number higher than the related non-nullable type |
120 | // |
121 | // earlyTTriplets |
122 | // late0Triplets |
123 | // |
124 | // typdef end |
125 | |
126 | public class Typdef implements java.lang.Cloneable { |
127 | //---------------------navigational members----------------------------------- |
128 | |
129 | //-----------------------------state------------------------------------------ |
130 | |
131 | // double byte character set |
132 | static final short CCSIDDBC = 1; |
133 | |
134 | // multi-byte character set |
135 | static final short CCSIDMBC = 2; |
136 | |
137 | // single byte character set |
138 | static final short CCSIDSBC = 3; |
139 | |
140 | // No CCSID |
141 | static final short NOCCSID = 0; |
142 | |
143 | // fixed length |
144 | static final short FIXEDLENGTH = 0; |
145 | |
146 | // 2-byte variable length |
147 | static final short TWOBYTELENGTH = 1; |
148 | |
149 | // 1-byte variable length |
150 | static final short ONEBYTELENGTH = 2; |
151 | |
152 | // decimal length |
153 | static final short DECIMALLENGTH = 3; |
154 | |
155 | // lob length |
156 | static final short LOBLENGTH = 4; |
157 | |
158 | public static final String UTF8ENCODING = "UTF8"; |
159 | |
160 | private static final int OVERRIDE_TABLE_SIZE = 0xff; |
161 | |
162 | private static final int[] fdocaTypeToRepresentationMap_ = { |
163 | /* 0x00 */ 0, |
164 | /* 0x01 */ Cursor.BYTES, /* FDOCA_TYPE_FIXEDBYTES */ |
165 | /* 0x02 */ Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARBYTES */ |
166 | /* 0x03 */ Cursor.NULL_TERMINATED_BYTES, /* FDOCA_TYPE_NTBYTES */ |
167 | /* 0x04 */ 0, |
168 | /* 0x05 */ 0, |
169 | /* 0x06 */ 0, |
170 | /* 0x07 */ Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLBYTE */ |
171 | /* 0x08 */ 0, |
172 | /* 0x09 */ 0, |
173 | /* 0x0A */ 0, |
174 | /* 0x0B */ 0, |
175 | /* 0x0C */ 0, |
176 | /* 0x0D */ 0, |
177 | /* 0x0E */ 0, |
178 | /* 0x0F */ 0, |
179 | /* 0x10 */ Cursor.STRING, /* FDOCA_TYPE_FIXEDCHAR */ |
180 | /* 0x11 */ Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARCHAR */ |
181 | /* 0x12 */ 0, |
182 | /* 0x13 */ 0, |
183 | /* 0x14 */ Cursor.NULL_TERMINATED_STRING, /* FDOCA_TYPE_NTCHAR */ |
184 | /* 0x15 */ 0, |
185 | /* 0x16 */ 0, |
186 | /* 0x17 */ 0, |
187 | /* 0x18 */ 0, |
188 | /* 0x19 */ Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLCHAR */ |
189 | /* 0x1A */ 0, |
190 | /* 0x1B */ 0, |
191 | /* 0x1C */ 0, |
192 | /* 0x1D */ 0, |
193 | /* 0x1E */ 0, |
194 | /* 0x1F */ 0, |
195 | /* 0x20 */ 0, |
196 | /* 0x21 */ 0, |
197 | /* 0x22 */ 0, |
198 | /* 0x23 */ SignedBinary.BIG_ENDIAN, /* FDOCA_TYPE_INTEGER_BE */ |
199 | /* 0x24 */ SignedBinary.LITTLE_ENDIAN, /* FDOCA_TYPE_INTEGER_LE */ |
200 | /* 0x25 */ 0, |
201 | /* 0x26 */ 0, |
202 | /* 0x27 */ 0, |
203 | /* 0x28 */ 0, |
204 | /* 0x29 */ 0, |
205 | /* 0x2A */ 0, |
206 | /* 0x2B */ 0, |
207 | /* 0x2C */ 0, |
208 | /* 0x2D */ 0, |
209 | /* 0x2E */ 0, |
210 | /* 0x2F */ 0, |
211 | /* 0x30 */ org.apache.derby.client.am.Decimal.PACKED_DECIMAL, /* FDOCA_TYPE_DECIMAL */ |
212 | /* 0x31 */ 0, |
213 | /* 0x32 */ 0, |
214 | /* 0x33 */ 0, |
215 | /* 0x34 */ 0, |
216 | /* 0x35 */ 0, |
217 | /* 0x36 */ 0, |
218 | /* 0x37 */ 0, |
219 | /* 0x38 */ 0, |
220 | /* 0x39 */ 0, |
221 | /* 0x3A */ 0, |
222 | /* 0x3B */ 0, |
223 | /* 0x3C */ 0, |
224 | /* 0x3D */ 0, |
225 | /* 0x3E */ 0, |
226 | /* 0x3F */ 0, |
227 | /* 0x40 */ 0, |
228 | /* 0x41 */ 0, |
229 | /* 0x42 */ 0, |
230 | /* 0x43 */ 0, |
231 | /* 0x44 */ 0, |
232 | /* 0x45 */ 0, |
233 | /* 0x46 */ 0, |
234 | /* 0x47 */ 0, |
235 | /* 0x48 */ org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, /* FDOCA_TYPE_FLOAT_IEEE */ |
236 | /* 0x49 */ 0, |
237 | /* 0x4A */ 0, |
238 | /* 0x4B */ 0, |
239 | /* 0x4C */ 0, |
240 | /* 0x4D */ 0, |
241 | /* 0x4E */ 0, |
242 | /* 0x4F */ 0, |
243 | /* 0x50 */ 0, /* FDOCA_TYPE_LOBBYTES */ // is 0 correct |
244 | /* 0x51 */ 0, /* FDOCA_TYPE_LOBCHAR */ // is 0 correct |
245 | /* 0x52 */ 0, |
246 | /* 0x53 */ 0, |
247 | /* 0x54 */ 0, |
248 | /* 0x55 */ 0, |
249 | /* 0x56 */ 0, |
250 | /* 0x57 */ 0, |
251 | /* 0x58 */ 0, |
252 | /* 0x59 */ 0, |
253 | /* 0x5A */ 0, |
254 | /* 0x5B */ 0, |
255 | /* 0x5C */ 0, |
256 | /* 0x5D */ 0, |
257 | /* 0x5E */ 0, |
258 | /* 0x5F */ 0 |
259 | }; |
260 | |
261 | // |
262 | // FIXME: Instead of magic numbers, the first arg in each of these |
263 | // constructor calls should be the corresponding constant from |
264 | // DRDAConstants. |
265 | // |
266 | protected static final FdocaSimpleDataArray[] environmentTables_ = { |
267 | /* 0x00 Empties */ |
268 | null, |
269 | /* 0x01 Empties */ |
270 | null, |
271 | /* 0x02 4-byte int */ |
272 | new FdocaSimpleDataArray(0x02, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
273 | /* 0x03 null 4-byte int */ |
274 | new FdocaSimpleDataArray(0x03, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
275 | /* 0x04 2-byte int */ |
276 | new FdocaSimpleDataArray(0x04, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH), |
277 | /* 0x05 null 2-byte int */ |
278 | new FdocaSimpleDataArray(0x05, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH), |
279 | /* 0x06 1-byte int */ |
280 | new FdocaSimpleDataArray(0x06, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), |
281 | /* 0x07 null 1-byte int */ |
282 | new FdocaSimpleDataArray(0x07, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), |
283 | /* 0x08 16-byte bin float */ |
284 | new FdocaSimpleDataArray(0x08, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH), |
285 | /* 0x09 null 16-byte bin float */ |
286 | new FdocaSimpleDataArray(0x09, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH), |
287 | /* 0x0A 8-byte bin float */ |
288 | new FdocaSimpleDataArray(0x0A, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH), |
289 | /* 0x0B null 8-byte bin float */ |
290 | new FdocaSimpleDataArray(0x0B, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH), |
291 | /* 0x0C 4-byte bin float */ |
292 | new FdocaSimpleDataArray(0x0C, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
293 | /* 0x0D null 4-byte bin float */ |
294 | new FdocaSimpleDataArray(0x0D, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
295 | /* 0x0E Fixed Decimal */ |
296 | new FdocaSimpleDataArray(0x0E, FdocaConstants.FDOCA_TYPE_DECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH), |
297 | /* 0x0F null Fixed Decimal */ |
298 | new FdocaSimpleDataArray(0x0F, FdocaConstants.FDOCA_TYPE_NDECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH), |
299 | /* 0x10 empties */ |
300 | null, |
301 | /* 0x11 empties */ |
302 | null, |
303 | /* 0x12 Numeric */ |
304 | null, |
305 | /* 0x13 null Numeric */ |
306 | null, |
307 | /* 0x14 Empties */ |
308 | null, |
309 | /* 0x15 Empties */ |
310 | null, |
311 | /* 0x16 Big int */ |
312 | new FdocaSimpleDataArray(0x16, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH), |
313 | /* 0x17 null Big int */ |
314 | new FdocaSimpleDataArray(0x17, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH), |
315 | /* 0x18 Large Obj Bytes Loc */ |
316 | new FdocaSimpleDataArray(0x18, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
317 | /* 0x19 null Large Obj Bytes Loc */ |
318 | new FdocaSimpleDataArray(0x19, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
319 | /* 0x1A Empties */ |
320 | null, |
321 | /* 0x1B null Large Obj Char Loc */ |
322 | new FdocaSimpleDataArray(0x1B, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
323 | /* 0x1C Large Obj Char DBCS Loc */ |
324 | new FdocaSimpleDataArray(0x1C, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
325 | /* 0x1D null Large Obj Char DBCS Loc */ |
326 | new FdocaSimpleDataArray(0x1D, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), |
327 | /* 0x1E Row Identifier */ |
328 | new FdocaSimpleDataArray(0x1E, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH), |
329 | /* 0x1F null Row Identifier */ |
330 | new FdocaSimpleDataArray(0x1F, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH), |
331 | /* 0x20 Date */ |
332 | new FdocaSimpleDataArray(0x20, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH), |
333 | /* 0x21 null Date */ |
334 | new FdocaSimpleDataArray(0x21, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH), |
335 | /* 0x22 Time */ |
336 | new FdocaSimpleDataArray(0x22, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH), |
337 | /* 0x23 null Time */ |
338 | new FdocaSimpleDataArray(0x23, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH), |
339 | /* 0x24 Timestamp */ |
340 | new FdocaSimpleDataArray(0x24, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH), |
341 | /* 0x25 null Timestamp */ |
342 | new FdocaSimpleDataArray(0x25, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH), |
343 | /* 0x26 Fixed bytes */ |
344 | new FdocaSimpleDataArray(0x26, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH), |
345 | /* 0x27 null Fixed bytes */ |
346 | new FdocaSimpleDataArray(0x27, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH), |
347 | /* 0x28 Variable bytes */ |
348 | new FdocaSimpleDataArray(0x28, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), |
349 | /* 0x29 null Variable bytes */ |
350 | new FdocaSimpleDataArray(0x29, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), |
351 | /* 0x2A Long var bytes */ |
352 | new FdocaSimpleDataArray(0x2A, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), |
353 | /* 0x2B null Long var bytes */ |
354 | new FdocaSimpleDataArray(0x2B, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), |
355 | /* 0x2C Nullterm bytes */ |
356 | new FdocaSimpleDataArray(0x2C, FdocaConstants.FDOCA_TYPE_NTBYTES, Cursor.NULL_TERMINATED_BYTES, NOCCSID, 0, 1, 32767, FIXEDLENGTH), |
357 | /* 0x2D null Nullterm bytes */ |
358 | new FdocaSimpleDataArray(0x2D, FdocaConstants.FDOCA_TYPE_NNTBYTES, Cursor.NULL_TERMINATED_STRING, NOCCSID, 0, 1, 32767, FIXEDLENGTH), |
359 | /* 0x2E Nullterm SBCS */ |
360 | new FdocaSimpleDataArray(0x2E, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH), |
361 | /* 0x2F null Nullterm SBCS */ |
362 | new FdocaSimpleDataArray(0x2F, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH), |
363 | /* 0x30 Fix char SBCS */ |
364 | new FdocaSimpleDataArray(0x30, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH), |
365 | /* 0x31 null Fix char SBCS */ |
366 | new FdocaSimpleDataArray(0x31, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH), |
367 | /* 0x32 Var char SBCS */ |
368 | new FdocaSimpleDataArray(0x32, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
369 | /* 0x33 null Var char SBCS */ |
370 | new FdocaSimpleDataArray(0x33, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
371 | /* 0x34 Long var SBCS */ |
372 | new FdocaSimpleDataArray(0x34, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
373 | /* 0x35 null Long var SBCS */ |
374 | new FdocaSimpleDataArray(0x35, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
375 | /* 0x36 Fix char DBCS */ |
376 | new FdocaSimpleDataArray(0x36, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH), |
377 | /* 0x37 null Fix char DBCS */ |
378 | new FdocaSimpleDataArray(0x37, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH), |
379 | /* 0x38 Var char DBCS */ |
380 | new FdocaSimpleDataArray(0x38, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), |
381 | /* 0x39 null Var char DBCS */ |
382 | new FdocaSimpleDataArray(0x39, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), |
383 | /* 0x3A Long var DBCS */ |
384 | new FdocaSimpleDataArray(0x3A, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), |
385 | /* 0x3B null Long var DBCS */ |
386 | new FdocaSimpleDataArray(0x3B, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), |
387 | /* 0x3C Fix char MBCS */ |
388 | new FdocaSimpleDataArray(0x3C, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH), |
389 | /* 0x3D null Fix char MBCS */ |
390 | new FdocaSimpleDataArray(0x3D, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH), |
391 | /* 0x3E Var char MBCS */ |
392 | new FdocaSimpleDataArray(0x3E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
393 | /* 0x3F null Var char MBCS */ |
394 | new FdocaSimpleDataArray(0x3F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
395 | /* 0x40 Long var MBCS */ |
396 | new FdocaSimpleDataArray(0x40, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
397 | /* 0x41 null Long var MBCS */ |
398 | new FdocaSimpleDataArray(0x41, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
399 | /* 0x42 Nullterm MBCS */ |
400 | new FdocaSimpleDataArray(0x42, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH), |
401 | /* 0x43 null Nullterm MBCS */ |
402 | new FdocaSimpleDataArray(0x43, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH), |
403 | /* 0x44 L String bytes */ |
404 | new FdocaSimpleDataArray(0x44, FdocaConstants.FDOCA_TYPE_PSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH), |
405 | /* 0x45 null L String bytes */ |
406 | new FdocaSimpleDataArray(0x45, FdocaConstants.FDOCA_TYPE_NPSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH), |
407 | /* 0x46 L String SBCS */ |
408 | new FdocaSimpleDataArray(0x46, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH), |
409 | /* 0x47 null L String SBCS */ |
410 | new FdocaSimpleDataArray(0x47, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH), |
411 | /* 0x48 L String MBCS */ |
412 | new FdocaSimpleDataArray(0x48, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH), |
413 | /* 0x49 null L String MBCS */ |
414 | new FdocaSimpleDataArray(0x49, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH), |
415 | /* 0x4A Empties */ |
416 | null, |
417 | /* 0x4B Empties */ |
418 | null, |
419 | /* 0x4C SBCS */ |
420 | new FdocaSimpleDataArray(0x4C, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
421 | /* 0x4D null SBCS */ |
422 | new FdocaSimpleDataArray(0x4D, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), |
423 | /* 0x4E MBCS */ |
424 | new FdocaSimpleDataArray(0x4E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
425 | /* 0x4F null MBCS */ |
426 | new FdocaSimpleDataArray(0x4F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), |
427 | /* 0x50 Empties */ |
428 | null, |
429 | /* 0x51 Empties */ |
430 | null, |
431 | /* 0x52 Empties */ |
432 | null, |
433 | /* 0x53 Empties */ |
434 | null, |
435 | /* 0x54 Empties */ |
436 | null, |
437 | /* 0x55 Empties */ |
438 | null, |
439 | /* 0x56 Empties */ |
440 | null, |
441 | /* 0x57 Empties */ |
442 | null, |
443 | /* 0x58 Empties */ |
444 | null, |
445 | /* 0x59 Empties */ |
446 | null, |
447 | /* 0x5A Empties */ |
448 | null, |
449 | /* 0x5B Empties */ |
450 | null, |
451 | /* 0x5C Empties */ |
452 | null, |
453 | /* 0x5D Empties */ |
454 | null, |
455 | /* 0x5E Empties */ |
456 | null, |
457 | /* 0x5F Empties */ |
458 | null, |
459 | /* 0x60 Empties */ |
460 | null, |
461 | /* 0x61 Empties */ |
462 | null, |
463 | /* 0x62 Empties */ |
464 | null, |
465 | /* 0x63 Empties */ |
466 | null, |
467 | /* 0x64 Empties */ |
468 | null, |
469 | /* 0x65 Empties */ |
470 | null, |
471 | /* 0x66 Empties */ |
472 | null, |
473 | /* 0x67 Empties */ |
474 | null, |
475 | /* 0x68 Empties */ |
476 | null, |
477 | /* 0x69 Empties */ |
478 | null, |
479 | /* 0x6A Empties */ |
480 | null, |
481 | /* 0x6B Empties */ |
482 | null, |
483 | /* 0x6C Empties */ |
484 | null, |
485 | /* 0x6D Empties */ |
486 | null, |
487 | /* 0x6E Empties */ |
488 | null, |
489 | /* 0x6F Empties */ |
490 | null, |
491 | /* 0x70 Empties */ |
492 | null, |
493 | /* 0x71 Empties */ |
494 | null, |
495 | /* 0x72 Empties */ |
496 | null, |
497 | /* 0x73 Empties */ |
498 | null, |
499 | /* 0x74 Empties */ |
500 | null, |
501 | /* 0x75 Empties */ |
502 | null, |
503 | /* 0x76 Empties */ |
504 | null, |
505 | /* 0x77 Empties */ |
506 | null, |
507 | /* 0x78 Empties */ |
508 | null, |
509 | /* 0x79 Empties */ |
510 | null, |
511 | /* 0x7A Empties */ |
512 | null, |
513 | /* 0x7B Empties */ |
514 | null, |
515 | /* 0x7C Empties */ |
516 | null, |
517 | /* 0x7D Empties */ |
518 | null, |
519 | /* 0x7E Empties */ |
520 | null, |
521 | /* 0x7F Empties */ |
522 | null, |
523 | /* 0x80 Empties */ |
524 | null, |
525 | /* 0x81 Empties */ |
526 | null, |
527 | /* 0x82 Empties */ |
528 | null, |
529 | /* 0x83 Empties */ |
530 | null, |
531 | /* 0x84 Empties */ |
532 | null, |
533 | /* 0x85 Empties */ |
534 | null, |
535 | /* 0x86 Empties */ |
536 | null, |
537 | /* 0x87 Empties */ |
538 | null, |
539 | /* 0x88 Empties */ |
540 | null, |
541 | /* 0x89 Empties */ |
542 | null, |
543 | /* 0x8A Empties */ |
544 | null, |
545 | /* 0x8B Empties */ |
546 | null, |
547 | /* 0x8C Empties */ |
548 | null, |
549 | /* 0x8D Empties */ |
550 | null, |
551 | /* 0x8E Empties */ |
552 | null, |
553 | /* 0x8F Empties */ |
554 | null, |
555 | /* 0x90 Empties */ |
556 | null, |
557 | /* 0x91 Empties */ |
558 | null, |
559 | /* 0x92 Empties */ |
560 | null, |
561 | /* 0x93 Empties */ |
562 | null, |
563 | /* 0x94 Empties */ |
564 | null, |
565 | /* 0x95 Empties */ |
566 | null, |
567 | /* 0x96 Empties */ |
568 | null, |
569 | /* 0x97 Empties */ |
570 | null, |
571 | /* 0x98 Empties */ |
572 | null, |
573 | /* 0x99 Empties */ |
574 | null, |
575 | /* 0x9A Empties */ |
576 | null, |
577 | /* 0x9B Empties */ |
578 | null, |
579 | /* 0x9C Empties */ |
580 | null, |
581 | /* 0x9D Empties */ |
582 | null, |
583 | /* 0x9E Empties */ |
584 | null, |
585 | /* 0x9F Empties */ |
586 | null, |
587 | /* 0xA0 Empties */ |
588 | null, |
589 | /* 0xA1 Empties */ |
590 | null, |
591 | /* 0xA2 Empties */ |
592 | null, |
593 | /* 0xA3 Empties */ |
594 | null, |
595 | /* 0xA4 Empties */ |
596 | null, |
597 | /* 0xA5 Empties */ |
598 | null, |
599 | /* 0xA6 Empties */ |
600 | null, |
601 | /* 0xA7 Empties */ |
602 | null, |
603 | /* 0xA8 Empties */ |
604 | null, |
605 | /* 0xA9 Empties */ |
606 | null, |
607 | /* 0xAA Empties */ |
608 | null, |
609 | /* 0xAB Empties */ |
610 | null, |
611 | /* 0xAC Empties */ |
612 | null, |
613 | /* 0xAD Empties */ |
614 | null, |
615 | /* 0xAE Empties */ |
616 | null, |
617 | /* 0xAF Empties */ |
618 | null, |
619 | /* 0xB0 Empties */ |
620 | null, |
621 | /* 0xB1 Empties */ |
622 | null, |
623 | /* 0xB2 Empties */ |
624 | null, |
625 | /* 0xB3 Empties */ |
626 | null, |
627 | /* 0xB4 Empties */ |
628 | null, |
629 | /* 0xB5 Empties */ |
630 | null, |
631 | /* 0xB6 Empties */ |
632 | null, |
633 | /* 0xB7 Empties */ |
634 | null, |
635 | /* 0xB8 Empties */ |
636 | null, |
637 | /* 0xB9 Empties */ |
638 | null, |
639 | /* 0xBA Empties */ |
640 | null, |
641 | /* 0xBB Empties */ |
642 | null, |
643 | /* 0xBC Empties */ |
644 | null, |
645 | /* 0xBD Empties */ |
646 | null, |
647 | /* 0xBE Empties */ |
648 | null, |
649 | /* 0xBF Empties */ |
650 | null, |
651 | /* 0xC0 Empties */ |
652 | null, |
653 | /* 0xC1 Empties */ |
654 | null, |
655 | /* 0xC2 Empties */ |
656 | null, |
657 | /* 0xC3 Empties */ |
658 | null, |
659 | /* 0xC4 Empties */ |
660 | null, |
661 | /* 0xC5 Empties */ |
662 | null, |
663 | /* 0xC6 Empties */ |
664 | null, |
665 | /* 0xC7 Empties */ |
666 | null, |
667 | /* 0xC8 Large object bytes */ |
668 | new FdocaSimpleDataArray(0xC8, FdocaConstants.FDOCA_TYPE_LOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH), |
669 | /* 0xC9 null Large object bytes */ |
670 | new FdocaSimpleDataArray(0xC9, FdocaConstants.FDOCA_TYPE_NLOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH), |
671 | /* 0xCA Large object char SBCS */ |
672 | new FdocaSimpleDataArray(0xCA, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH), |
673 | /* 0xCB null Large object char SBCS */ |
674 | new FdocaSimpleDataArray(0xCB, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH), |
675 | /* 0xCC Large object char DBCS */ |
676 | new FdocaSimpleDataArray(0xCC, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH), |
677 | /* 0xCD null Large object char DBCS */ |
678 | new FdocaSimpleDataArray(0xCD, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH), |
679 | /* 0xCE Large object char MBCS */ |
680 | new FdocaSimpleDataArray(0xCE, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH), |
681 | /* 0xCF null Large object char MBCS */ |
682 | new FdocaSimpleDataArray(0xCF, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH), |
683 | /* 0xD0 boolean */ |
684 | new FdocaSimpleDataArray(DRDAConstants.DRDA_TYPE_BOOLEAN, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), |
685 | /* 0xD1 null boolean */ |
686 | new FdocaSimpleDataArray(DRDAConstants.DRDA_TYPE_NBOOLEAN, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), |
687 | }; |
688 | |
689 | private static final int[] protocolToJdbcTypes_ = { |
690 | 0x00, // 0x00 Empties |
691 | 0x00, // 0x01 Empties |
692 | java.sql.Types.INTEGER, // 0x02 4-byte int |
693 | java.sql.Types.INTEGER, // 0x03 null 4-byte int |
694 | java.sql.Types.SMALLINT, // 0x04 2-byte int |
695 | java.sql.Types.SMALLINT, // 0x05 null 2-byte int |
696 | java.sql.Types.TINYINT, // 0x06 1-byte int |
697 | java.sql.Types.TINYINT, // 0x07 null 1-byte int |
698 | java.sql.Types.DECIMAL, // 0x08 16-byte bin float |
699 | java.sql.Types.DECIMAL, // 0x09 null 16-byte bin float |
700 | java.sql.Types.DOUBLE, // 0x0A 8-byte bin float |
701 | java.sql.Types.DOUBLE, // 0x0B null 8-byte bin float |
702 | java.sql.Types.REAL, // 0x0C 4-byte bin float |
703 | java.sql.Types.REAL, // 0x0D null 4-byte bin float |
704 | java.sql.Types.DECIMAL, // 0x0E Fixed Decimal |
705 | java.sql.Types.DECIMAL, // 0x0F null Fixed Decimal |
706 | java.sql.Types.DECIMAL, // 0x10 Zone Decimal |
707 | java.sql.Types.DECIMAL, // 0x11 null Zone Decimal |
708 | java.sql.Types.DECIMAL, // 0x12 Numeirc |
709 | java.sql.Types.DECIMAL, // 0x13 null Numeric |
710 | 0x00, // 0x14 Empties |
711 | 0x00, // 0x15 Empties |
712 | java.sql.Types.BIGINT, // 0x16 Big int |
713 | java.sql.Types.BIGINT, // 0x17 null Big int |
714 | 0x00, |
715 | 0x00, |
716 | 0x00, |
717 | 0x00, |
718 | 0x00, |
719 | 0x00, |
720 | 0x00, |
721 | 0x00, |
722 | java.sql.Types.DATE, // 0x20 Date |
723 | java.sql.Types.DATE, // 0x21 null Date |
724 | java.sql.Types.TIME, // 0x22 Time |
725 | java.sql.Types.TIME, // 0x23 null Time |
726 | java.sql.Types.TIMESTAMP, // 0x24 Timestamp |
727 | java.sql.Types.TIMESTAMP, // 0x25 null Timestamp |
728 | java.sql.Types.BINARY, // 0x26 Fixed bytes |
729 | java.sql.Types.BINARY, // 0x27 null Fixed bytes |
730 | java.sql.Types.VARBINARY, // 0x28 Variable bytes |
731 | java.sql.Types.VARBINARY, // 0x29 null Variable bytes |
732 | java.sql.Types.LONGVARBINARY, // 0x2A Long var bytes |
733 | java.sql.Types.LONGVARBINARY, // 0x2B null Long var bytes |
734 | java.sql.Types.VARBINARY, // 0x2C Nullterm bytes |
735 | java.sql.Types.VARBINARY, // 0x2D null Nullterm bytes |
736 | java.sql.Types.CHAR, // 0x2E Nullterm SBCS |
737 | java.sql.Types.CHAR, // 0x2F null Nullterm SBCS |
738 | java.sql.Types.CHAR, // 0x30 Fix char SBCS |
739 | java.sql.Types.CHAR, // 0x31 null Fix char SBCS |
740 | java.sql.Types.VARCHAR, // 0x32 Var char SBCS |
741 | java.sql.Types.VARCHAR, // 0x33 null Var char SBCS |
742 | java.sql.Types.LONGVARCHAR, // 0x34 Long var SBCS |
743 | java.sql.Types.LONGVARCHAR, // 0x35 null Long var SBCS |
744 | 0x00, // 0x36 Empties |
745 | 0x00, // 0x37 Empties |
746 | 0x00, // 0x38 Empties |
747 | 0x00, // 0x39 Empties |
748 | 0x00, // 0x3A Empties |
749 | 0x00, // 0x3B Empties |
750 | // The following will have to be changed later for situations where |
751 | java.sql.Types.CHAR, // 0x3C Fix char MBCS |
752 | java.sql.Types.CHAR, // 0x3D null Fix char MBCS |
753 | java.sql.Types.VARCHAR, // 0x3E Var char MBCS |
754 | java.sql.Types.VARCHAR, // 0x3F null Var char MBCS |
755 | java.sql.Types.LONGVARCHAR, // 0x40 Long var MBCS |
756 | java.sql.Types.LONGVARCHAR, // 0x41 null Long var MBCS |
757 | java.sql.Types.CHAR, // 0x42 Nullterm MBCS |
758 | java.sql.Types.CHAR, // 0x43 null Nullterm MBCS |
759 | java.sql.Types.VARBINARY, // 0x44 L String bytes |
760 | java.sql.Types.VARBINARY, // 0x45 null L String bytes |
761 | java.sql.Types.VARCHAR, // 0x46 L String SBCS |
762 | java.sql.Types.VARCHAR, // 0x47 null L String SBCS |
763 | java.sql.Types.VARCHAR, // 0x48 L String MBCS |
764 | java.sql.Types.VARCHAR, // 0x49 null L String MBCS |
765 | 0x00, // 0x4A Empties |
766 | 0x00, // 0x4B Empties |
767 | java.sql.Types.VARCHAR, // 0x4C SBCS |
768 | java.sql.Types.VARCHAR, // 0x4D null SBCS |
769 | java.sql.Types.VARCHAR, // 0x4E MBCS |
770 | java.sql.Types.VARCHAR, // 0x4F null MBCS |
771 | 0x00, // 0x50 Empties |
772 | 0x00, // 0x51 Empties |
773 | 0x00, // 0x52 Empties |
774 | 0x00, // 0x53 Empties |
775 | 0x00, // 0x54 Empties |
776 | 0x00, // 0x55 Empties |
777 | 0x00, // 0x56 Empties |
778 | 0x00, // 0x57 Empties |
779 | 0x00, // 0x58 Empties |
780 | 0x00, // 0x59 Empties |
781 | 0x00, // 0x5A Empties |
782 | 0x00, // 0x5B Empties |
783 | 0x00, // 0x5C Empties |
784 | 0x00, // 0x5D Empties |
785 | 0x00, // 0x5E Empties |
786 | 0x00, // 0x5F Empties |
787 | 0x00, // 0x60 Empties |
788 | 0x00, // 0x61 Empties |
789 | 0x00, // 0x62 Empties |
790 | 0x00, // 0x63 Empties |
791 | 0x00, // 0x64 Empties |
792 | 0x00, // 0x65 Empties |
793 | 0x00, // 0x66 Empties |
794 | 0x00, // 0x67 Empties |
795 | 0x00, // 0x68 Empties |
796 | 0x00, // 0x69 Empties |
797 | 0x00, // 0x6A Empties |
798 | 0x00, // 0x6B Empties |
799 | 0x00, // 0x6C Empties |
800 | 0x00, // 0x6D Empties |
801 | 0x00, // 0x6E Empties |
802 | 0x00, // 0x6F Empties |
803 | 0x00, // 0x70 Empties |
804 | 0x00, // 0x71 Empties |
805 | 0x00, // 0x72 Empties |
806 | 0x00, // 0x73 Empties |
807 | 0x00, // 0x74 Empties |
808 | 0x00, // 0x75 Empties |
809 | 0x00, // 0x76 Empties |
810 | 0x00, // 0x77 Empties |
811 | 0x00, // 0x78 Empties |
812 | 0x00, // 0x79 Empties |
813 | 0x00, // 0x7A Empties |
814 | 0x00, // 0x7B Empties |
815 | 0x00, // 0x7C Empties |
816 | 0x00, // 0x7D Empties |
817 | 0x00, // 0x7E Empties |
818 | 0x00, // 0x7F Empties |
819 | 0x00, // 0x80 Empties |
820 | 0x00, // 0x81 Empties |
821 | 0x00, // 0x82 Empties |
822 | 0x00, // 0x83 Empties |
823 | 0x00, // 0x84 Empties |
824 | 0x00, // 0x85 Empties |
825 | 0x00, // 0x86 Empties |
826 | 0x00, // 0x87 Empties |
827 | 0x00, // 0x88 Empties |
828 | 0x00, // 0x89 Empties |
829 | 0x00, // 0x8A Empties |
830 | 0x00, // 0x8B Empties |
831 | 0x00, // 0x8C Empties |
832 | 0x00, // 0x8D Empties |
833 | 0x00, // 0x8E Empties |
834 | 0x00, // 0x8F Empties |
835 | 0x00, // 0x90 Empties |
836 | 0x00, // 0x91 Empties |
837 | 0x00, // 0x92 Empties |
838 | 0x00, // 0x93 Empties |
839 | 0x00, // 0x94 Empties |
840 | 0x00, // 0x95 Empties |
841 | 0x00, // 0x96 Empties |
842 | 0x00, // 0x97 Empties |
843 | 0x00, // 0x98 Empties |
844 | 0x00, // 0x99 Empties |
845 | 0x00, // 0x9A Empties |
846 | 0x00, // 0x9B Empties |
847 | 0x00, // 0x9C Empties |
848 | 0x00, // 0x9D Empties |
849 | 0x00, // 0x9E Empties |
850 | 0x00, // 0x9F Empties |
851 | 0x00, // 0xA0 Empties |
852 | 0x00, // 0xA1 Empties |
853 | 0x00, // 0xA2 Empties |
854 | 0x00, // 0xA3 Empties |
855 | 0x00, // 0xA4 Empties |
856 | 0x00, // 0xA5 Empties |
857 | 0x00, // 0xA6 Empties |
858 | 0x00, // 0xA7 Empties |
859 | 0x00, // 0xA8 Empties |
860 | 0x00, // 0xA9 Empties |
861 | 0x00, // 0xAA Empties |
862 | 0x00, // 0xAB Empties |
863 | 0x00, // 0xAC Empties |
864 | 0x00, // 0xAD Empties |
865 | 0x00, // 0xAE Empties |
866 | 0x00, // 0xAF Empties |
867 | 0x00, // 0xB0 Empties |
868 | 0x00, // 0xB1 Empties |
869 | 0x00, // 0xB2 Empties |
870 | 0x00, // 0xB3 Empties |
871 | 0x00, // 0xB4 Empties |
872 | 0x00, // 0xB5 Empties |
873 | 0x00, // 0xB6 Empties |
874 | 0x00, // 0xB7 Empties |
875 | 0x00, // 0xB8 Empties |
876 | 0x00, // 0xB9 Empties |
877 | 0x00, // 0xBA Empties |
878 | 0x00, // 0xBB Empties |
879 | 0x00, // 0xBC Empties |
880 | 0x00, // 0xBD Empties |
881 | 0x00, // 0xBE Empties |
882 | 0x00, // 0xBF Empties |
883 | 0x00, // 0xC0 Empties |
884 | 0x00, // 0xC1 Empties |
885 | 0x00, // 0xC2 Empties |
886 | 0x00, // 0xC3 Empties |
887 | 0x00, // 0xC4 Empties |
888 | 0x00, // 0xC5 Empties |
889 | 0x00, // 0xC6 Empties |
890 | 0x00, // 0xC7 Empties |
891 | java.sql.Types.BLOB, // 0xC8 Large object bytes |
892 | java.sql.Types.BLOB, // 0xC9 null Large object bytes |
893 | java.sql.Types.CLOB, // 0xCA Large object char SBCS |
894 | java.sql.Types.CLOB, // 0xCB null Large object char SBCS |
895 | 0x00, |
896 | 0x00, |
897 | java.sql.Types.CLOB, // 0xCE Large object char MBCS |
898 | java.sql.Types.CLOB, // 0xCF null Large object char MBCS |
899 | JDBC30Translation.BOOLEAN, // 0xD0 boolean |
900 | JDBC30Translation.BOOLEAN, // 0xD1 null boolean |
901 | }; |
902 | |
903 | |
904 | private NetAgent netAgent_; |
905 | private String typdefnam_; |
906 | |
907 | private int ccsidSbc_; |
908 | private boolean ccsidSbcSet_; |
909 | private String ccsidSbcEncoding_; |
910 | |
911 | private int ccsidDbc_; |
912 | private boolean ccsidDbcSet_; |
913 | private String ccsidDbcEncoding_; |
914 | |
915 | |
916 | private int ccsidMbc_; |
917 | private boolean ccsidMbcSet_; |
918 | private String ccsidMbcEncoding_; |
919 | |
920 | |
921 | protected int environment_; |
922 | private boolean mddOverride_ = false; |
923 | private FdocaSimpleDataArray overrideTable_[] = new FdocaSimpleDataArray[OVERRIDE_TABLE_SIZE]; |
924 | |
925 | //---------------------constructors/finalizer--------------------------------- |
926 | |
927 | |
928 | Typdef(NetAgent netAgent) throws DisconnectException { |
929 | this.initialize(netAgent, 0, false, 0, false, 0, false, null); |
930 | } |
931 | |
932 | Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam) throws DisconnectException { |
933 | this.initialize(netAgent, ccsidSbc, true, 0, false, 0, false, typdefnam); |
934 | } |
935 | |
936 | public Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam, int ccsidDbc, int ccsidMbc) throws DisconnectException { |
937 | this.initialize(netAgent, ccsidSbc, true, ccsidMbc, true, ccsidDbc, true, typdefnam); |
938 | } |
939 | |
940 | private void initialize(NetAgent netAgent, |
941 | int ccsidSbc, |
942 | boolean ccsidSbcSet, |
943 | int ccsidMbc, |
944 | boolean ccsidMbcSet, |
945 | int ccsidDbc, |
946 | boolean ccsidDbcSet, |
947 | String typdefnam) throws DisconnectException { |
948 | netAgent_ = netAgent; |
949 | ccsidSbc_ = ccsidSbc; |
950 | ccsidSbcSet_ = ccsidSbcSet; |
951 | ccsidSbcEncoding_ = null; |
952 | ccsidMbc_ = ccsidMbc; |
953 | ccsidMbcSet_ = ccsidMbcSet; |
954 | ccsidMbcEncoding_ = null; |
955 | ccsidDbc_ = ccsidDbc; |
956 | ccsidDbcSet_ = ccsidDbcSet; |
957 | ccsidDbcEncoding_ = null; |
958 | setTypdefnam(typdefnam); |
959 | } |
960 | |
961 | //-------------------------private and package friendly methods--------------- |
962 | |
963 | String getTypdefnam() { |
964 | return typdefnam_; |
965 | } |
966 | |
967 | void setTypdefnam(String typdefnam) throws DisconnectException { |
968 | typdefnam_ = typdefnam; |
969 | if (typdefnam_ == null) { |
970 | return; |
971 | } |
972 | |
973 | } |
974 | |
975 | int getCcsidSbc() { |
976 | return ccsidSbc_; |
977 | } |
978 | |
979 | void setCcsidSbc(int ccsid) { |
980 | ccsidSbc_ = ccsid; |
981 | ccsidSbcSet_ = true; |
982 | ccsidSbcEncoding_ = null; |
983 | } |
984 | |
985 | void clearCcsidSbc() { |
986 | ccsidSbc_ = 0; |
987 | ccsidSbcSet_ = false; |
988 | ccsidSbcEncoding_ = null; |
989 | } |
990 | |
991 | boolean isCcsidSbcSet() { |
992 | return ccsidSbcSet_; |
993 | } |
994 | |
995 | // analyze exception handling some more here |
996 | String getCcsidSbcEncoding() throws DisconnectException { |
997 | if (ccsidSbcEncoding_ == null) { |
998 | ccsidSbcEncoding_ = UTF8ENCODING; |
999 | } |
1000 | return ccsidSbcEncoding_; |
1001 | } |
1002 | |
1003 | int getCcsidDbc() { |
1004 | return ccsidDbc_; |
1005 | } |
1006 | |
1007 | void setCcsidDbc(int ccsid) { |
1008 | ccsidDbc_ = ccsid; |
1009 | ccsidDbcSet_ = true; |
1010 | ccsidDbcEncoding_ = null; |
1011 | } |
1012 | |
1013 | void clearCcsidDbc() { |
1014 | ccsidDbc_ = 0; |
1015 | ccsidDbcSet_ = false; |
1016 | ccsidDbcEncoding_ = null; |
1017 | } |
1018 | |
1019 | boolean isCcsidDbcSet() { |
1020 | return ccsidDbcSet_; |
1021 | } |
1022 | |
1023 | // analyze exception handling some more here |
1024 | String getCcsidDbcEncoding() throws DisconnectException { |
1025 | if (ccsidDbcEncoding_ == null) { |
1026 | ccsidDbcEncoding_ = UTF8ENCODING; |
1027 | } |
1028 | return ccsidDbcEncoding_; |
1029 | } |
1030 | |
1031 | int getCcsidMbc() { |
1032 | return ccsidMbc_; |
1033 | } |
1034 | |
1035 | void setCcsidMbc(int ccsid) { |
1036 | ccsidMbc_ = ccsid; |
1037 | ccsidMbcSet_ = true; |
1038 | ccsidMbcEncoding_ = null; |
1039 | } |
1040 | |
1041 | void clearCcsidMbc() { |
1042 | ccsidMbc_ = 0; |
1043 | ccsidMbcSet_ = false; |
1044 | ccsidMbcEncoding_ = null; |
1045 | } |
1046 | |
1047 | boolean isCcsidMbcSet() { |
1048 | return ccsidMbcSet_; |
1049 | } |
1050 | |
1051 | // analyze exception handling some more here |
1052 | String getCcsidMbcEncoding() throws DisconnectException { |
1053 | if (ccsidMbcEncoding_ == null) { |
1054 | ccsidMbcEncoding_ = UTF8ENCODING; |
1055 | } |
1056 | return ccsidMbcEncoding_; |
1057 | } |
1058 | |
1059 | int getByteOrder() { |
1060 | return SignedBinary.BIG_ENDIAN; |
1061 | } |
1062 | |
1063 | public Object clone() { |
1064 | try { |
1065 | return super.clone(); |
1066 | } catch (java.lang.CloneNotSupportedException e) { |
1067 | return null; // this shouldn't happen since we implement the cloneable interface |
1068 | } |
1069 | } |
1070 | |
1071 | // Populates netCursor descriptors, rename this populateCursorDescriptors() |
1072 | void updateColumn(NetCursor netCursor, |
1073 | int columnIndex, |
1074 | int protocolLid, |
1075 | int protocolLength) throws DisconnectException { |
1076 | FdocaSimpleDataArray sda = environmentTables_[protocolLid]; |
1077 | |
1078 | if ((mddOverride_) && (overrideTable_[protocolLid] != null)) { |
1079 | sda = overrideTable_[protocolLid]; |
1080 | } |
1081 | |
1082 | if (sda == null) { |
1083 | netAgent_.accumulateChainBreakingReadExceptionAndThrow( |
1084 | new DisconnectException(netAgent_, |
1085 | new ClientMessageId(SQLState.NET_INVALID_FDOCA_ID))); |
1086 | } |
1087 | |
1088 | // 2. Set Null indicator based on PROTOCOL Type. |
1089 | // Nullable SQL and PROTOCOL types are all odd numbers and the nullable |
1090 | // type is one number higher than the related non-nullable type. |
1091 | netCursor.nullable_[columnIndex] = ((sda.protocolType_ % 2) == 1); |
1092 | |
1093 | // 3. Update CCSID |
1094 | // The typdef object should store the java encoding, |
1095 | switch (sda.ccsid_) { |
1096 | case CCSIDSBC: |
1097 | netCursor.charsetName_[columnIndex] = getCcsidSbcEncoding(); |
1098 | netCursor.ccsid_[columnIndex] = this.ccsidSbc_; |
1099 | break; |
1100 | case CCSIDMBC: |
1101 | if (isCcsidMbcSet() && (ccsidMbc_ != 0)) { |
1102 | netCursor.charsetName_[columnIndex] = getCcsidMbcEncoding(); |
1103 | netCursor.ccsid_[columnIndex] = ccsidMbc_; |
1104 | } else { |
1105 | // if the server didn't return a mixed byte ccsid, set both the |
1106 | // encoding and the btc reference to null. see CCSIDDBC comment below. |
1107 | netCursor.charsetName_[columnIndex] = null; |
1108 | netCursor.ccsid_[columnIndex] = 0; |
1109 | } |
1110 | break; |
1111 | case CCSIDDBC: |
1112 | if (isCcsidDbcSet() && (ccsidDbc_ != 0)) { |
1113 | netCursor.charsetName_[columnIndex] = getCcsidDbcEncoding(); |
1114 | netCursor.ccsid_[columnIndex] = this.ccsidDbc_; |
1115 | } else { |
1116 | // if the server didn't return a double byte ccsid, set both the |
1117 | // encoding and the btc reference to null. later an exception will |
1118 | // be thrown on the getXXX method. calling the getCcsidDbcEncoding method |
1119 | // will throw the exception here and this is not desirable. |
1120 | netCursor.charsetName_[columnIndex] = null; |
1121 | netCursor.ccsid_[columnIndex] = 0; |
1122 | } |
1123 | break; |
1124 | |
1125 | default: // This default case is used for mdd override ccsids. |
1126 | // In this case the sda.ccsid_ is the actual native ccsid, |
1127 | // otherwise the sda.ccsid_ is a placeholder: |
1128 | // CCSIDMBC, CCSIDDDBC, CCSIDSBC to indicate that |
1129 | // the actual ccsid is the connection's ccsid (in protocol lingo the connection's typdef ccsid). |
1130 | netCursor.charsetName_[columnIndex] = UTF8ENCODING; |
1131 | netCursor.ccsid_[columnIndex] = sda.ccsid_; |
1132 | break; |
1133 | } |
1134 | |
1135 | // 5. Set the length fdoca length. |
1136 | // For some types this may be a precision and a scale. |
1137 | // this includes FIXED DECIMAL (PROTOCOL type 0x0E, 0X0F), |
1138 | // retain the high order placeholder for lobs) |
1139 | // this includes LARGE OBJECT BYTES (PROTOCOL type 0xC8, 0xC9) |
1140 | // LARGE OBJECT CHAR SBCS (PROTOCOL type 0xCA, 0xCB) |
1141 | // LARGE OBJECT CHAR DBCS (PROTOCOL type 0xCC, 0xCD) |
1142 | // LARGE OBJECT CHAR MIXED (PROTOCOL type 0xCE, 0xCF) |
1143 | // also set the hasLobs_ flag to true |
1144 | if ((sda.protocolType_ >= 0xC8) && (sda.protocolType_ <= 0xCF)) { |
1145 | // retain placeholder information |
1146 | // right now just set the length... |
1147 | // probably need to accomodate for the high order placeholder bit |
1148 | netCursor.fdocaLength_[columnIndex] = protocolLength; |
1149 | netCursor.hasLobs_ = true; |
1150 | } else { |
1151 | netCursor.fdocaLength_[columnIndex] = protocolLength; |
1152 | } |
1153 | |
1154 | // 6. Set jdbc type. |
1155 | netCursor.jdbcTypes_[columnIndex] = protocolToJdbcTypes_[sda.protocolType_]; |
1156 | |
1157 | // 7. Get the number of bytes to read for variable length data. |
1158 | netCursor.typeToUseForComputingDataLength_[columnIndex] = sda.typeToUseForComputingDataLength_; |
1159 | |
1160 | // 8. Update the maximumRowSize |
1161 | // Count : column null indicator + |
1162 | // column length + |
1163 | // posibly a 2-byte length for varchar columns |
1164 | switch (netCursor.typeToUseForComputingDataLength_[columnIndex]) { |
1165 | case DECIMALLENGTH: |
1166 | netCursor.maximumRowSize_ += 1 + 16; |
1167 | break; |
1168 | case LOBLENGTH: |
1169 | netCursor.maximumRowSize_ += 1 + (netCursor.fdocaLength_[columnIndex] & 0x7fff); |
1170 | break; |
1171 | default: |
1172 | netCursor.maximumRowSize_ += 1 + netCursor.fdocaLength_[columnIndex] + 2; // 2 is the length indicator for varchar |
1173 | break; |
1174 | } |
1175 | |
1176 | // 9. Get the character size. |
1177 | if (sda.characterSize_ == 2) { |
1178 | netCursor.isGraphic_[columnIndex] = true; |
1179 | } |
1180 | |
1181 | } |
1182 | |
1183 | // Called before the code parses a descriptor |
1184 | void clearMddOverrides() { |
1185 | if (mddOverride_ == false) { |
1186 | return; |
1187 | } |
1188 | |
1189 | mddOverride_ = false; |
1190 | for (int i = 0; i < OVERRIDE_TABLE_SIZE; i++) { |
1191 | overrideTable_[i] = null; |
1192 | } |
1193 | } |
1194 | |
1195 | // Called after the code parses a descriptor |
1196 | void setMddOverride(int protocolType, |
1197 | int fdocaTripletLid, |
1198 | int fdocaFieldType, |
1199 | int ccsid, |
1200 | int characterSize, |
1201 | int mode, |
1202 | int length) { |
1203 | mddOverride_ = true; |
1204 | |
1205 | |
1206 | if (overrideTable_[fdocaTripletLid] == null) { |
1207 | overrideTable_[fdocaTripletLid] = new FdocaSimpleDataArray |
1208 | (protocolType, |
1209 | fdocaFieldType, |
1210 | fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f], |
1211 | ccsid, |
1212 | characterSize, |
1213 | mode, |
1214 | length, |
1215 | mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType)); |
1216 | } else { |
1217 | overrideTable_[fdocaTripletLid].update(protocolType, |
1218 | fdocaFieldType, |
1219 | fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f], |
1220 | ccsid, |
1221 | characterSize, |
1222 | mode, |
1223 | length, |
1224 | mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType)); |
1225 | } |
1226 | } |
1227 | |
1228 | private int mapFdocaTypeToTypeToUseForComputingDataLength(int fdocaFieldType) { |
1229 | switch (fdocaFieldType & 0x7f) { // &0x7f masks out the null indicator |
1230 | case FdocaConstants.FDOCA_TYPE_VARCHAR: |
1231 | case FdocaConstants.FDOCA_TYPE_VARBYTES: |
1232 | return Typdef.TWOBYTELENGTH; |
1233 | case FdocaConstants.FDOCA_TYPE_DECIMAL: |
1234 | case FdocaConstants.FDOCA_TYPE_NUMERIC_CHAR: |
1235 | return Typdef.DECIMALLENGTH; |
1236 | case FdocaConstants.FDOCA_TYPE_LOBBYTES: |
1237 | case FdocaConstants.FDOCA_TYPE_LOBCHAR: |
1238 | return Typdef.LOBLENGTH; |
1239 | case FdocaConstants.FDOCA_TYPE_PSCLBYTE: |
1240 | case FdocaConstants.FDOCA_TYPE_PSCLCHAR: |
1241 | return Typdef.ONEBYTELENGTH; |
1242 | default: |
1243 | return 0; |
1244 | } |
1245 | } |
1246 | } |