KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > net > Typdef


1 /*
2
3    Derby - Class org.apache.derby.client.net.Typdef
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21
22 package org.apache.derby.client.net;
23
24 import org.apache.derby.iapi.reference.DRDAConstants;
25 import org.apache.derby.iapi.reference.JDBC30Translation;
26 import org.apache.derby.client.am.Cursor;
27 import org.apache.derby.client.am.DisconnectException;
28 import org.apache.derby.client.am.SignedBinary;
29 import org.apache.derby.client.am.ClientMessageId;
30 import org.apache.derby.shared.common.reference.SQLState;
31
32 //
33
// General Notes
34
// Descriptors are overriden using two distinct mechanisms
35
// - new TYPDEFNAM and TYPDEFOVR specifications which override environmental
36
// specifications originally established at connect time.
37
// - MDD/SDA pairs providing specific field level overrides for user data
38
// not conforming to the TYPDEFNAM and TYPDEFOVR specifications currently
39
// in effect. Grouping triplets then refer to the new SDAs to specify
40
// the actual representation of the user data.
41
// - There are two types of early descriptor triplets, the T and the M triplets.
42
// Early
43
// ---------------------------
44
// Environmental Grp Row Arr
45
// TTTTTTTTTTTTT MMMMMMMMMMM
46
// - The T triplets are established by the TYPDEFNAM and TYPDEFOVR values.
47
// These can be overridden for any command or reply by specifying
48
// a new value for TYPDEFNAM and TYPDEFOVR.
49
// - The M triplets are established by the MGRLVL parameter on EXCSAT.
50
// They define PROTOCOL information units such as the SQLCA.
51
// These grouping and structuring triplets cannot be overriden
52
// Any change would mean a change in what information was exchanged
53
// rather than just how that information would be represented.
54
// - There are two types of late descriptor triplets, the O and U triplets.
55
// Late
56
// ---------------------------
57
// Environmental Grp Row Arr
58
// OOOOOOOOOOOOO UUUUUUUUUUU
59
// - The O triplets provide specific overrides.
60
// - The U triplets define actual user data, sometimes in combination
61
// with PROTOCOL information units. The U triplets reference O triplets
62
// and both T triplets and M triplets (which in turn reference T triplets).
63
// - Rules for assigning LIDs to O triplets
64
// - select LID within range of 1 to 255.
65
// - select LID which doesn't interfere with references to early triplets
66
// or O triplets.
67
//
68
// requirements
69
// - if this object handles overrides, they are only in effect for one
70
// command or the reply to one command. Make sure that the correct
71
// "in effect" overrides are used especially when MDD overrides are present.
72
// - raise error if no CCSIDMBC or CCSIDDBC has been specified for mixed or
73
// double byte data. Return SQLSTATE 57017 with 0 as source CCSID token.
74
// Possible errors:
75
// - check for valid lid at SQLAM level.
76
// - if the lid is greater than the max
77
// supported lid then the descriptor is invalid for the supported SQLAM level.
78
// Error Checking and Reporting Notes taken from PROTOCOL manual.
79
// - If the receiver of an FDODSC finds it in error, the error must
80
// be reported with a DDM message DSCINVRM. If the descriptor
81
// passes PROTOCOL validity checks, but the data does not match the
82
// descriptors, the mismatch must be reported with a DDM message DTAMCHRM.
83
// so descriptor must be correct and valid and then the data must match
84
// the descriptor.
85
// - Possible General Errors
86
// - 01 FD:OCA Triplet not used in PROTOCOL descriptors or Type code invalid.
87
// - 02 Triplet Sequence Error: the two possible sequences are:
88
// 1.) GDA,(CPT,)RLO<,RLO><== normal case with no overrrides
89
// 2.) MDD,SDA,(MDD,SDA,)MDD,GDA,(CPT,)\
90
// MDD,RLO<,MDD,RLO>
91
// where () indicates an optional repeating group and <> indicates
92
// a field allowed only when arrays are expected.
93
// - 03 An array description is required, and this one does not
94
// describe an array (probably too many or too few RLO triplets).
95
// - 04 A row description is required, and this one does not describe a row
96
// probably too many or too few RLO triplets.
97
// - 05 Late Environmental Descriptor just received not supported (probably
98
// due to non-support of requested overrides).
99
// - 06 Malformed triplet; missing required parameter.
100
// - 07 Parameter value not acceptable.
101
// - Possible MDD Errors
102
// - 11 MDD present is not recognized as PROTOCOL Descriptor
103
// - 12 MDD class not recognized as valid PROTOCOL class.
104
// - 13 MDD type not recognized as valid PROTOCOL type.
105
// - Possible SDA Errors
106
// - 21 Representation incompatible with PROTOCOL type (in prior MDD).
107
// - 22 CCSID not supported
108
// - Possible GDA/CPT Errors
109
// - 32 GDA references a LID that is not an SDA or GDA.
110
// - 33 GDA length override exceeds limits.
111
// - 34 GDA precision exceeds limits.
112
// - 35 GDA scale > precision or scale negative
113
// - 36 GDA length override missing or incompatible with protocol type.
114
// - Possible RLO Errors
115
// - 41 RLO references a LID that is not an RLO or GDA
116
// - 42 RLO fails to reference a required GDA or RLO (for example, QRYDSC
117
// must include a reference to SQLCAGRP).
118
//
119
// Nullable SQL and PROTOCOL types are all odd numbers and nullable type is
120
// one number higher than the related non-nullable type
121
//
122
// earlyTTriplets
123
// late0Triplets
124
//
125
// typdef end
126

127 public class Typdef implements java.lang.Cloneable JavaDoc {
128     //---------------------navigational members-----------------------------------
129

130     //-----------------------------state------------------------------------------
131

132     // double byte character set
133
static final short CCSIDDBC = 1;
134
135     // multi-byte character set
136
static final short CCSIDMBC = 2;
137
138     // single byte character set
139
static final short CCSIDSBC = 3;
140
141     // No CCSID
142
static final short NOCCSID = 0;
143
144     // fixed length
145
static final short FIXEDLENGTH = 0;
146
147     // 2-byte variable length
148
static final short TWOBYTELENGTH = 1;
149
150     // 1-byte variable length
151
static final short ONEBYTELENGTH = 2;
152
153     // decimal length
154
static final short DECIMALLENGTH = 3;
155
156     // lob length
157
static final short LOBLENGTH = 4;
158
159     public static final String JavaDoc UTF8ENCODING = "UTF8";
160
161     private static final int OVERRIDE_TABLE_SIZE = 0xff;
162
163     private static final int[] fdocaTypeToRepresentationMap_ = {
164         /* 0x00 */ 0,
165         /* 0x01 */ Cursor.BYTES, /* FDOCA_TYPE_FIXEDBYTES */
166         /* 0x02 */ Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARBYTES */
167         /* 0x03 */ Cursor.NULL_TERMINATED_BYTES, /* FDOCA_TYPE_NTBYTES */
168         /* 0x04 */ 0,
169         /* 0x05 */ 0,
170         /* 0x06 */ 0,
171         /* 0x07 */ Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLBYTE */
172         /* 0x08 */ 0,
173         /* 0x09 */ 0,
174         /* 0x0A */ 0,
175         /* 0x0B */ 0,
176         /* 0x0C */ 0,
177         /* 0x0D */ 0,
178         /* 0x0E */ 0,
179         /* 0x0F */ 0,
180         /* 0x10 */ Cursor.STRING, /* FDOCA_TYPE_FIXEDCHAR */
181         /* 0x11 */ Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARCHAR */
182         /* 0x12 */ 0,
183         /* 0x13 */ 0,
184         /* 0x14 */ Cursor.NULL_TERMINATED_STRING, /* FDOCA_TYPE_NTCHAR */
185         /* 0x15 */ 0,
186         /* 0x16 */ 0,
187         /* 0x17 */ 0,
188         /* 0x18 */ 0,
189         /* 0x19 */ Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLCHAR */
190         /* 0x1A */ 0,
191         /* 0x1B */ 0,
192         /* 0x1C */ 0,
193         /* 0x1D */ 0,
194         /* 0x1E */ 0,
195         /* 0x1F */ 0,
196         /* 0x20 */ 0,
197         /* 0x21 */ 0,
198         /* 0x22 */ 0,
199         /* 0x23 */ SignedBinary.BIG_ENDIAN, /* FDOCA_TYPE_INTEGER_BE */
200         /* 0x24 */ SignedBinary.LITTLE_ENDIAN, /* FDOCA_TYPE_INTEGER_LE */
201         /* 0x25 */ 0,
202         /* 0x26 */ 0,
203         /* 0x27 */ 0,
204         /* 0x28 */ 0,
205         /* 0x29 */ 0,
206         /* 0x2A */ 0,
207         /* 0x2B */ 0,
208         /* 0x2C */ 0,
209         /* 0x2D */ 0,
210         /* 0x2E */ 0,
211         /* 0x2F */ 0,
212         /* 0x30 */ org.apache.derby.client.am.Decimal.PACKED_DECIMAL, /* FDOCA_TYPE_DECIMAL */
213         /* 0x31 */ 0,
214         /* 0x32 */ 0,
215         /* 0x33 */ 0,
216         /* 0x34 */ 0,
217         /* 0x35 */ 0,
218         /* 0x36 */ 0,
219         /* 0x37 */ 0,
220         /* 0x38 */ 0,
221         /* 0x39 */ 0,
222         /* 0x3A */ 0,
223         /* 0x3B */ 0,
224         /* 0x3C */ 0,
225         /* 0x3D */ 0,
226         /* 0x3E */ 0,
227         /* 0x3F */ 0,
228         /* 0x40 */ 0,
229         /* 0x41 */ 0,
230         /* 0x42 */ 0,
231         /* 0x43 */ 0,
232         /* 0x44 */ 0,
233         /* 0x45 */ 0,
234         /* 0x46 */ 0,
235         /* 0x47 */ 0,
236         /* 0x48 */ org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, /* FDOCA_TYPE_FLOAT_IEEE */
237         /* 0x49 */ 0,
238         /* 0x4A */ 0,
239         /* 0x4B */ 0,
240         /* 0x4C */ 0,
241         /* 0x4D */ 0,
242         /* 0x4E */ 0,
243         /* 0x4F */ 0,
244         /* 0x50 */ 0, /* FDOCA_TYPE_LOBBYTES */ // is 0 correct
245
/* 0x51 */ 0, /* FDOCA_TYPE_LOBCHAR */ // is 0 correct
246
/* 0x52 */ 0,
247         /* 0x53 */ 0,
248         /* 0x54 */ 0,
249         /* 0x55 */ 0,
250         /* 0x56 */ 0,
251         /* 0x57 */ 0,
252         /* 0x58 */ 0,
253         /* 0x59 */ 0,
254         /* 0x5A */ 0,
255         /* 0x5B */ 0,
256         /* 0x5C */ 0,
257         /* 0x5D */ 0,
258         /* 0x5E */ 0,
259         /* 0x5F */ 0
260     };
261
262     //
263
// FIXME: Instead of magic numbers, the first arg in each of these
264
// constructor calls should be the corresponding constant from
265
// DRDAConstants.
266
//
267
protected static final FdocaSimpleDataArray[] environmentTables_ = {
268         /* 0x00 Empties */
269         null,
270         /* 0x01 Empties */
271         null,
272         /* 0x02 4-byte int */
273         new FdocaSimpleDataArray(0x02, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH),
274         /* 0x03 null 4-byte int */
275         new FdocaSimpleDataArray(0x03, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH),
276         /* 0x04 2-byte int */
277         new FdocaSimpleDataArray(0x04, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH),
278         /* 0x05 null 2-byte int */
279         new FdocaSimpleDataArray(0x05, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH),
280         /* 0x06 1-byte int */
281         new FdocaSimpleDataArray(0x06, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH),
282         /* 0x07 null 1-byte int */
283         new FdocaSimpleDataArray(0x07, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH),
284         /* 0x08 16-byte bin float */
285         new FdocaSimpleDataArray(0x08, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH),
286         /* 0x09 null 16-byte bin float */
287         new FdocaSimpleDataArray(0x09, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH),
288         /* 0x0A 8-byte bin float */
289         new FdocaSimpleDataArray(0x0A, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH),
290         /* 0x0B null 8-byte bin float */
291         new FdocaSimpleDataArray(0x0B, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH),
292         /* 0x0C 4-byte bin float */
293         new FdocaSimpleDataArray(0x0C, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH),
294         /* 0x0D null 4-byte bin float */
295         new FdocaSimpleDataArray(0x0D, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH),
296         /* 0x0E Fixed Decimal */
297         new FdocaSimpleDataArray(0x0E, FdocaConstants.FDOCA_TYPE_DECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH),
298         /* 0x0F null Fixed Decimal */
299         new FdocaSimpleDataArray(0x0F, FdocaConstants.FDOCA_TYPE_NDECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH),
300         /* 0x10 empties */
301         null,
302         /* 0x11 empties */
303         null,
304         /* 0x12 Numeric */
305         null,
306         /* 0x13 null Numeric */
307         null,
308         /* 0x14 Empties */
309         null,
310         /* 0x15 Empties */
311         null,
312         /* 0x16 Big int */
313         new FdocaSimpleDataArray(0x16, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH),
314         /* 0x17 null Big int */
315         new FdocaSimpleDataArray(0x17, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH),
316         /* 0x18 Large Obj Bytes Loc */
317         new FdocaSimpleDataArray(0x18, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH),
318         /* 0x19 null Large Obj Bytes Loc */
319         new FdocaSimpleDataArray(0x19, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH),
320         /* 0x1A Empties */
321         null,
322         /* 0x1B null Large Obj Char Loc */
323         new FdocaSimpleDataArray(0x1B, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH),
324         /* 0x1C Large Obj Char DBCS Loc */
325         new FdocaSimpleDataArray(0x1C, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH),
326         /* 0x1D null Large Obj Char DBCS Loc */
327         new FdocaSimpleDataArray(0x1D, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH),
328         /* 0x1E Row Identifier */
329         new FdocaSimpleDataArray(0x1E, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH),
330         /* 0x1F null Row Identifier */
331         new FdocaSimpleDataArray(0x1F, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH),
332         /* 0x20 Date */
333         new FdocaSimpleDataArray(0x20, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH),
334         /* 0x21 null Date */
335         new FdocaSimpleDataArray(0x21, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH),
336         /* 0x22 Time */
337         new FdocaSimpleDataArray(0x22, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH),
338         /* 0x23 null Time */
339         new FdocaSimpleDataArray(0x23, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH),
340         /* 0x24 Timestamp */
341         new FdocaSimpleDataArray(0x24, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH),
342         /* 0x25 null Timestamp */
343         new FdocaSimpleDataArray(0x25, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH),
344         /* 0x26 Fixed bytes */
345         new FdocaSimpleDataArray(0x26, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH),
346         /* 0x27 null Fixed bytes */
347         new FdocaSimpleDataArray(0x27, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH),
348         /* 0x28 Variable bytes */
349         new FdocaSimpleDataArray(0x28, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH),
350         /* 0x29 null Variable bytes */
351         new FdocaSimpleDataArray(0x29, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH),
352         /* 0x2A Long var bytes */
353         new FdocaSimpleDataArray(0x2A, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH),
354         /* 0x2B null Long var bytes */
355         new FdocaSimpleDataArray(0x2B, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH),
356         /* 0x2C Nullterm bytes */
357         new FdocaSimpleDataArray(0x2C, FdocaConstants.FDOCA_TYPE_NTBYTES, Cursor.NULL_TERMINATED_BYTES, NOCCSID, 0, 1, 32767, FIXEDLENGTH),
358         /* 0x2D null Nullterm bytes */
359         new FdocaSimpleDataArray(0x2D, FdocaConstants.FDOCA_TYPE_NNTBYTES, Cursor.NULL_TERMINATED_STRING, NOCCSID, 0, 1, 32767, FIXEDLENGTH),
360         /* 0x2E Nullterm SBCS */
361         new FdocaSimpleDataArray(0x2E, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH),
362         /* 0x2F null Nullterm SBCS */
363         new FdocaSimpleDataArray(0x2F, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH),
364         /* 0x30 Fix char SBCS */
365         new FdocaSimpleDataArray(0x30, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH),
366         /* 0x31 null Fix char SBCS */
367         new FdocaSimpleDataArray(0x31, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH),
368         /* 0x32 Var char SBCS */
369         new FdocaSimpleDataArray(0x32, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
370         /* 0x33 null Var char SBCS */
371         new FdocaSimpleDataArray(0x33, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
372         /* 0x34 Long var SBCS */
373         new FdocaSimpleDataArray(0x34, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
374         /* 0x35 null Long var SBCS */
375         new FdocaSimpleDataArray(0x35, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
376         /* 0x36 Fix char DBCS */
377         new FdocaSimpleDataArray(0x36, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH),
378         /* 0x37 null Fix char DBCS */
379         new FdocaSimpleDataArray(0x37, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH),
380         /* 0x38 Var char DBCS */
381         new FdocaSimpleDataArray(0x38, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH),
382         /* 0x39 null Var char DBCS */
383         new FdocaSimpleDataArray(0x39, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH),
384         /* 0x3A Long var DBCS */
385         new FdocaSimpleDataArray(0x3A, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH),
386         /* 0x3B null Long var DBCS */
387         new FdocaSimpleDataArray(0x3B, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH),
388         /* 0x3C Fix char MBCS */
389         new FdocaSimpleDataArray(0x3C, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH),
390         /* 0x3D null Fix char MBCS */
391         new FdocaSimpleDataArray(0x3D, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH),
392         /* 0x3E Var char MBCS */
393         new FdocaSimpleDataArray(0x3E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
394         /* 0x3F null Var char MBCS */
395         new FdocaSimpleDataArray(0x3F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
396         /* 0x40 Long var MBCS */
397         new FdocaSimpleDataArray(0x40, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
398         /* 0x41 null Long var MBCS */
399         new FdocaSimpleDataArray(0x41, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
400         /* 0x42 Nullterm MBCS */
401         new FdocaSimpleDataArray(0x42, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH),
402         /* 0x43 null Nullterm MBCS */
403         new FdocaSimpleDataArray(0x43, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH),
404         /* 0x44 L String bytes */
405         new FdocaSimpleDataArray(0x44, FdocaConstants.FDOCA_TYPE_PSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH),
406         /* 0x45 null L String bytes */
407         new FdocaSimpleDataArray(0x45, FdocaConstants.FDOCA_TYPE_NPSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH),
408         /* 0x46 L String SBCS */
409         new FdocaSimpleDataArray(0x46, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH),
410         /* 0x47 null L String SBCS */
411         new FdocaSimpleDataArray(0x47, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH),
412         /* 0x48 L String MBCS */
413         new FdocaSimpleDataArray(0x48, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH),
414         /* 0x49 null L String MBCS */
415         new FdocaSimpleDataArray(0x49, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH),
416         /* 0x4A Empties */
417         null,
418         /* 0x4B Empties */
419         null,
420         /* 0x4C SBCS */
421         new FdocaSimpleDataArray(0x4C, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
422         /* 0x4D null SBCS */
423         new FdocaSimpleDataArray(0x4D, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH),
424         /* 0x4E MBCS */
425         new FdocaSimpleDataArray(0x4E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
426         /* 0x4F null MBCS */
427         new FdocaSimpleDataArray(0x4F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH),
428         /* 0x50 Empties */
429         null,
430         /* 0x51 Empties */
431         null,
432         /* 0x52 Empties */
433         null,
434         /* 0x53 Empties */
435         null,
436         /* 0x54 Empties */
437         null,
438         /* 0x55 Empties */
439         null,
440         /* 0x56 Empties */
441         null,
442         /* 0x57 Empties */
443         null,
444         /* 0x58 Empties */
445         null,
446         /* 0x59 Empties */
447         null,
448         /* 0x5A Empties */
449         null,
450         /* 0x5B Empties */
451         null,
452         /* 0x5C Empties */
453         null,
454         /* 0x5D Empties */
455         null,
456         /* 0x5E Empties */
457         null,
458         /* 0x5F Empties */
459         null,
460         /* 0x60 Empties */
461         null,
462         /* 0x61 Empties */
463         null,
464         /* 0x62 Empties */
465         null,
466         /* 0x63 Empties */
467         null,
468         /* 0x64 Empties */
469         null,
470         /* 0x65 Empties */
471         null,
472         /* 0x66 Empties */
473         null,
474         /* 0x67 Empties */
475         null,
476         /* 0x68 Empties */
477         null,
478         /* 0x69 Empties */
479         null,
480         /* 0x6A Empties */
481         null,
482         /* 0x6B Empties */
483         null,
484         /* 0x6C Empties */
485         null,
486         /* 0x6D Empties */
487         null,
488         /* 0x6E Empties */
489         null,
490         /* 0x6F Empties */
491         null,
492         /* 0x70 Empties */
493         null,
494         /* 0x71 Empties */
495         null,
496         /* 0x72 Empties */
497         null,
498         /* 0x73 Empties */
499         null,
500         /* 0x74 Empties */
501         null,
502         /* 0x75 Empties */
503         null,
504         /* 0x76 Empties */
505         null,
506         /* 0x77 Empties */
507         null,
508         /* 0x78 Empties */
509         null,
510         /* 0x79 Empties */
511         null,
512         /* 0x7A Empties */
513         null,
514         /* 0x7B Empties */
515         null,
516         /* 0x7C Empties */
517         null,
518         /* 0x7D Empties */
519         null,
520         /* 0x7E Empties */
521         null,
522         /* 0x7F Empties */
523         null,
524         /* 0x80 Empties */
525         null,
526         /* 0x81 Empties */
527         null,
528         /* 0x82 Empties */
529         null,
530         /* 0x83 Empties */
531         null,
532         /* 0x84 Empties */
533         null,
534         /* 0x85 Empties */
535         null,
536         /* 0x86 Empties */
537         null,
538         /* 0x87 Empties */
539         null,
540         /* 0x88 Empties */
541         null,
542         /* 0x89 Empties */
543         null,
544         /* 0x8A Empties */
545         null,
546         /* 0x8B Empties */
547         null,
548         /* 0x8C Empties */
549         null,
550         /* 0x8D Empties */
551         null,
552         /* 0x8E Empties */
553         null,
554         /* 0x8F Empties */
555         null,
556         /* 0x90 Empties */
557         null,
558         /* 0x91 Empties */
559         null,
560         /* 0x92 Empties */
561         null,
562         /* 0x93 Empties */
563         null,
564         /* 0x94 Empties */
565         null,
566         /* 0x95 Empties */
567         null,
568         /* 0x96 Empties */
569         null,
570         /* 0x97 Empties */
571         null,
572         /* 0x98 Empties */
573         null,
574         /* 0x99 Empties */
575         null,
576         /* 0x9A Empties */
577         null,
578         /* 0x9B Empties */
579         null,
580         /* 0x9C Empties */
581         null,
582         /* 0x9D Empties */
583         null,
584         /* 0x9E Empties */
585         null,
586         /* 0x9F Empties */
587         null,
588         /* 0xA0 Empties */
589         null,
590         /* 0xA1 Empties */
591         null,
592         /* 0xA2 Empties */
593         null,
594         /* 0xA3 Empties */
595         null,
596         /* 0xA4 Empties */
597         null,
598         /* 0xA5 Empties */
599         null,
600         /* 0xA6 Empties */
601         null,
602         /* 0xA7 Empties */
603         null,
604         /* 0xA8 Empties */
605         null,
606         /* 0xA9 Empties */
607         null,
608         /* 0xAA Empties */
609         null,
610         /* 0xAB Empties */
611         null,
612         /* 0xAC Empties */
613         null,
614         /* 0xAD Empties */
615         null,
616         /* 0xAE Empties */
617         null,
618         /* 0xAF Empties */
619         null,
620         /* 0xB0 Empties */
621         null,
622         /* 0xB1 Empties */
623         null,
624         /* 0xB2 Empties */
625         null,
626         /* 0xB3 Empties */
627         null,
628         /* 0xB4 Empties */
629         null,
630         /* 0xB5 Empties */
631         null,
632         /* 0xB6 Empties */
633         null,
634         /* 0xB7 Empties */
635         null,
636         /* 0xB8 Empties */
637         null,
638         /* 0xB9 Empties */
639         null,
640         /* 0xBA Empties */
641         null,
642         /* 0xBB Empties */
643         null,
644         /* 0xBC Empties */
645         null,
646         /* 0xBD Empties */
647         null,
648         /* 0xBE Empties */
649         null,
650         /* 0xBF Empties */
651         null,
652         /* 0xC0 Empties */
653         null,
654         /* 0xC1 Empties */
655         null,
656         /* 0xC2 Empties */
657         null,
658         /* 0xC3 Empties */
659         null,
660         /* 0xC4 Empties */
661         null,
662         /* 0xC5 Empties */
663         null,
664         /* 0xC6 Empties */
665         null,
666         /* 0xC7 Empties */
667         null,
668         /* 0xC8 Large object bytes */
669         new FdocaSimpleDataArray(0xC8, FdocaConstants.FDOCA_TYPE_LOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH),
670         /* 0xC9 null Large object bytes */
671         new FdocaSimpleDataArray(0xC9, FdocaConstants.FDOCA_TYPE_NLOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH),
672         /* 0xCA Large object char SBCS */
673         new FdocaSimpleDataArray(0xCA, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH),
674         /* 0xCB null Large object char SBCS */
675         new FdocaSimpleDataArray(0xCB, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH),
676         /* 0xCC Large object char DBCS */
677         new FdocaSimpleDataArray(0xCC, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH),
678         /* 0xCD null Large object char DBCS */
679         new FdocaSimpleDataArray(0xCD, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH),
680         /* 0xCE Large object char MBCS */
681         new FdocaSimpleDataArray(0xCE, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH),
682         /* 0xCF null Large object char MBCS */
683         new FdocaSimpleDataArray(0xCF, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH),
684     };
685
686     private static final int[] protocolToJdbcTypes_ = {
687         0x00, // 0x00 Empties
688
0x00, // 0x01 Empties
689
java.sql.Types.INTEGER, // 0x02 4-byte int
690
java.sql.Types.INTEGER, // 0x03 null 4-byte int
691
java.sql.Types.SMALLINT, // 0x04 2-byte int
692
java.sql.Types.SMALLINT, // 0x05 null 2-byte int
693
java.sql.Types.TINYINT, // 0x06 1-byte int
694
java.sql.Types.TINYINT, // 0x07 null 1-byte int
695
java.sql.Types.DECIMAL, // 0x08 16-byte bin float
696
java.sql.Types.DECIMAL, // 0x09 null 16-byte bin float
697
java.sql.Types.DOUBLE, // 0x0A 8-byte bin float
698
java.sql.Types.DOUBLE, // 0x0B null 8-byte bin float
699
java.sql.Types.REAL, // 0x0C 4-byte bin float
700
java.sql.Types.REAL, // 0x0D null 4-byte bin float
701
java.sql.Types.DECIMAL, // 0x0E Fixed Decimal
702
java.sql.Types.DECIMAL, // 0x0F null Fixed Decimal
703
java.sql.Types.DECIMAL, // 0x10 Zone Decimal
704
java.sql.Types.DECIMAL, // 0x11 null Zone Decimal
705
java.sql.Types.DECIMAL, // 0x12 Numeirc
706
java.sql.Types.DECIMAL, // 0x13 null Numeric
707
0x00, // 0x14 Empties
708
0x00, // 0x15 Empties
709
java.sql.Types.BIGINT, // 0x16 Big int
710
java.sql.Types.BIGINT, // 0x17 null Big int
711
0x00,
712         0x00,
713         0x00,
714         0x00,
715         0x00,
716         0x00,
717         0x00,
718         0x00,
719         java.sql.Types.DATE, // 0x20 Date
720
java.sql.Types.DATE, // 0x21 null Date
721
java.sql.Types.TIME, // 0x22 Time
722
java.sql.Types.TIME, // 0x23 null Time
723
java.sql.Types.TIMESTAMP, // 0x24 Timestamp
724
java.sql.Types.TIMESTAMP, // 0x25 null Timestamp
725
java.sql.Types.BINARY, // 0x26 Fixed bytes
726
java.sql.Types.BINARY, // 0x27 null Fixed bytes
727
java.sql.Types.VARBINARY, // 0x28 Variable bytes
728
java.sql.Types.VARBINARY, // 0x29 null Variable bytes
729
java.sql.Types.LONGVARBINARY, // 0x2A Long var bytes
730
java.sql.Types.LONGVARBINARY, // 0x2B null Long var bytes
731
java.sql.Types.VARBINARY, // 0x2C Nullterm bytes
732
java.sql.Types.VARBINARY, // 0x2D null Nullterm bytes
733
java.sql.Types.CHAR, // 0x2E Nullterm SBCS
734
java.sql.Types.CHAR, // 0x2F null Nullterm SBCS
735
java.sql.Types.CHAR, // 0x30 Fix char SBCS
736
java.sql.Types.CHAR, // 0x31 null Fix char SBCS
737
java.sql.Types.VARCHAR, // 0x32 Var char SBCS
738
java.sql.Types.VARCHAR, // 0x33 null Var char SBCS
739
java.sql.Types.LONGVARCHAR, // 0x34 Long var SBCS
740
java.sql.Types.LONGVARCHAR, // 0x35 null Long var SBCS
741
0x00, // 0x36 Empties
742
0x00, // 0x37 Empties
743
0x00, // 0x38 Empties
744
0x00, // 0x39 Empties
745
0x00, // 0x3A Empties
746
0x00, // 0x3B Empties
747
// The following will have to be changed later for situations where
748
java.sql.Types.CHAR, // 0x3C Fix char MBCS
749
java.sql.Types.CHAR, // 0x3D null Fix char MBCS
750
java.sql.Types.VARCHAR, // 0x3E Var char MBCS
751
java.sql.Types.VARCHAR, // 0x3F null Var char MBCS
752
java.sql.Types.LONGVARCHAR, // 0x40 Long var MBCS
753
java.sql.Types.LONGVARCHAR, // 0x41 null Long var MBCS
754
java.sql.Types.CHAR, // 0x42 Nullterm MBCS
755
java.sql.Types.CHAR, // 0x43 null Nullterm MBCS
756
java.sql.Types.VARBINARY, // 0x44 L String bytes
757
java.sql.Types.VARBINARY, // 0x45 null L String bytes
758
java.sql.Types.VARCHAR, // 0x46 L String SBCS
759
java.sql.Types.VARCHAR, // 0x47 null L String SBCS
760
java.sql.Types.VARCHAR, // 0x48 L String MBCS
761
java.sql.Types.VARCHAR, // 0x49 null L String MBCS
762
0x00, // 0x4A Empties
763
0x00, // 0x4B Empties
764
java.sql.Types.VARCHAR, // 0x4C SBCS
765
java.sql.Types.VARCHAR, // 0x4D null SBCS
766
java.sql.Types.VARCHAR, // 0x4E MBCS
767
java.sql.Types.VARCHAR, // 0x4F null MBCS
768
0x00, // 0x50 Empties
769
0x00, // 0x51 Empties
770
0x00, // 0x52 Empties
771
0x00, // 0x53 Empties
772
0x00, // 0x54 Empties
773
0x00, // 0x55 Empties
774
0x00, // 0x56 Empties
775
0x00, // 0x57 Empties
776
0x00, // 0x58 Empties
777
0x00, // 0x59 Empties
778
0x00, // 0x5A Empties
779
0x00, // 0x5B Empties
780
0x00, // 0x5C Empties
781
0x00, // 0x5D Empties
782
0x00, // 0x5E Empties
783
0x00, // 0x5F Empties
784
0x00, // 0x60 Empties
785
0x00, // 0x61 Empties
786
0x00, // 0x62 Empties
787
0x00, // 0x63 Empties
788
0x00, // 0x64 Empties
789
0x00, // 0x65 Empties
790
0x00, // 0x66 Empties
791
0x00, // 0x67 Empties
792
0x00, // 0x68 Empties
793
0x00, // 0x69 Empties
794
0x00, // 0x6A Empties
795
0x00, // 0x6B Empties
796
0x00, // 0x6C Empties
797
0x00, // 0x6D Empties
798
0x00, // 0x6E Empties
799
0x00, // 0x6F Empties
800
0x00, // 0x70 Empties
801
0x00, // 0x71 Empties
802
0x00, // 0x72 Empties
803
0x00, // 0x73 Empties
804
0x00, // 0x74 Empties
805
0x00, // 0x75 Empties
806
0x00, // 0x76 Empties
807
0x00, // 0x77 Empties
808
0x00, // 0x78 Empties
809
0x00, // 0x79 Empties
810
0x00, // 0x7A Empties
811
0x00, // 0x7B Empties
812
0x00, // 0x7C Empties
813
0x00, // 0x7D Empties
814
0x00, // 0x7E Empties
815
0x00, // 0x7F Empties
816
0x00, // 0x80 Empties
817
0x00, // 0x81 Empties
818
0x00, // 0x82 Empties
819
0x00, // 0x83 Empties
820
0x00, // 0x84 Empties
821
0x00, // 0x85 Empties
822
0x00, // 0x86 Empties
823
0x00, // 0x87 Empties
824
0x00, // 0x88 Empties
825
0x00, // 0x89 Empties
826
0x00, // 0x8A Empties
827
0x00, // 0x8B Empties
828
0x00, // 0x8C Empties
829
0x00, // 0x8D Empties
830
0x00, // 0x8E Empties
831
0x00, // 0x8F Empties
832
0x00, // 0x90 Empties
833
0x00, // 0x91 Empties
834
0x00, // 0x92 Empties
835
0x00, // 0x93 Empties
836
0x00, // 0x94 Empties
837
0x00, // 0x95 Empties
838
0x00, // 0x96 Empties
839
0x00, // 0x97 Empties
840
0x00, // 0x98 Empties
841
0x00, // 0x99 Empties
842
0x00, // 0x9A Empties
843
0x00, // 0x9B Empties
844
0x00, // 0x9C Empties
845
0x00, // 0x9D Empties
846
0x00, // 0x9E Empties
847
0x00, // 0x9F Empties
848
0x00, // 0xA0 Empties
849
0x00, // 0xA1 Empties
850
0x00, // 0xA2 Empties
851
0x00, // 0xA3 Empties
852
0x00, // 0xA4 Empties
853
0x00, // 0xA5 Empties
854
0x00, // 0xA6 Empties
855
0x00, // 0xA7 Empties
856
0x00, // 0xA8 Empties
857
0x00, // 0xA9 Empties
858
0x00, // 0xAA Empties
859
0x00, // 0xAB Empties
860
0x00, // 0xAC Empties
861
0x00, // 0xAD Empties
862
0x00, // 0xAE Empties
863
0x00, // 0xAF Empties
864
0x00, // 0xB0 Empties
865
0x00, // 0xB1 Empties
866
0x00, // 0xB2 Empties
867
0x00, // 0xB3 Empties
868
0x00, // 0xB4 Empties
869
0x00, // 0xB5 Empties
870
0x00, // 0xB6 Empties
871
0x00, // 0xB7 Empties
872
0x00, // 0xB8 Empties
873
0x00, // 0xB9 Empties
874
0x00, // 0xBA Empties
875
0x00, // 0xBB Empties
876
0x00, // 0xBC Empties
877
0x00, // 0xBD Empties
878
0x00, // 0xBE Empties
879
0x00, // 0xBF Empties
880
0x00, // 0xC0 Empties
881
0x00, // 0xC1 Empties
882
0x00, // 0xC2 Empties
883
0x00, // 0xC3 Empties
884
0x00, // 0xC4 Empties
885
0x00, // 0xC5 Empties
886
0x00, // 0xC6 Empties
887
0x00, // 0xC7 Empties
888
java.sql.Types.BLOB, // 0xC8 Large object bytes
889
java.sql.Types.BLOB, // 0xC9 null Large object bytes
890
java.sql.Types.CLOB, // 0xCA Large object char SBCS
891
java.sql.Types.CLOB, // 0xCB null Large object char SBCS
892
0x00,
893         0x00,
894         java.sql.Types.CLOB, // 0xCE Large object char MBCS
895
java.sql.Types.CLOB, // 0xCF null Large object char MBCS
896
};
897
898
899     private NetAgent netAgent_;
900     private String JavaDoc typdefnam_;
901
902     private int ccsidSbc_;
903     private boolean ccsidSbcSet_;
904     private String JavaDoc ccsidSbcEncoding_;
905
906     private int ccsidDbc_;
907     private boolean ccsidDbcSet_;
908     private String JavaDoc ccsidDbcEncoding_;
909
910
911     private int ccsidMbc_;
912     private boolean ccsidMbcSet_;
913     private String JavaDoc ccsidMbcEncoding_;
914
915
916     protected int environment_;
917     private boolean mddOverride_ = false;
918     private FdocaSimpleDataArray overrideTable_[] = new FdocaSimpleDataArray[OVERRIDE_TABLE_SIZE];
919
920     //---------------------constructors/finalizer---------------------------------
921

922
923     Typdef(NetAgent netAgent) throws DisconnectException {
924         this.initialize(netAgent, 0, false, 0, false, 0, false, null);
925     }
926
927     Typdef(NetAgent netAgent, int ccsidSbc, String JavaDoc typdefnam) throws DisconnectException {
928         this.initialize(netAgent, ccsidSbc, true, 0, false, 0, false, typdefnam);
929     }
930
931     public Typdef(NetAgent netAgent, int ccsidSbc, String JavaDoc typdefnam, int ccsidDbc, int ccsidMbc) throws DisconnectException {
932         this.initialize(netAgent, ccsidSbc, true, ccsidMbc, true, ccsidDbc, true, typdefnam);
933     }
934
935     private void initialize(NetAgent netAgent,
936                             int ccsidSbc,
937                             boolean ccsidSbcSet,
938                             int ccsidMbc,
939                             boolean ccsidMbcSet,
940                             int ccsidDbc,
941                             boolean ccsidDbcSet,
942                             String JavaDoc typdefnam) throws DisconnectException {
943         netAgent_ = netAgent;
944         ccsidSbc_ = ccsidSbc;
945         ccsidSbcSet_ = ccsidSbcSet;
946         ccsidSbcEncoding_ = null;
947         ccsidMbc_ = ccsidMbc;
948         ccsidMbcSet_ = ccsidMbcSet;
949         ccsidMbcEncoding_ = null;
950         ccsidDbc_ = ccsidDbc;
951         ccsidDbcSet_ = ccsidDbcSet;
952         ccsidDbcEncoding_ = null;
953         setTypdefnam(typdefnam);
954     }
955
956     //-------------------------private and package friendly methods---------------
957

958     String JavaDoc getTypdefnam() {
959         return typdefnam_;
960     }
961
962     void setTypdefnam(String JavaDoc typdefnam) throws DisconnectException {
963         typdefnam_ = typdefnam;
964         if (typdefnam_ == null) {
965             return;
966         }
967
968     }
969
970     int getCcsidSbc() {
971         return ccsidSbc_;
972     }
973
974     void setCcsidSbc(int ccsid) {
975         ccsidSbc_ = ccsid;
976         ccsidSbcSet_ = true;
977         ccsidSbcEncoding_ = null;
978     }
979
980     void clearCcsidSbc() {
981         ccsidSbc_ = 0;
982         ccsidSbcSet_ = false;
983         ccsidSbcEncoding_ = null;
984     }
985
986     boolean isCcsidSbcSet() {
987         return ccsidSbcSet_;
988     }
989
990     // analyze exception handling some more here
991
String JavaDoc getCcsidSbcEncoding() throws DisconnectException {
992         if (ccsidSbcEncoding_ == null) {
993             ccsidSbcEncoding_ = UTF8ENCODING;
994         }
995         return ccsidSbcEncoding_;
996     }
997
998     int getCcsidDbc() {
999         return ccsidDbc_;
1000    }
1001
1002    void setCcsidDbc(int ccsid) {
1003        ccsidDbc_ = ccsid;
1004        ccsidDbcSet_ = true;
1005        ccsidDbcEncoding_ = null;
1006    }
1007
1008    void clearCcsidDbc() {
1009        ccsidDbc_ = 0;
1010        ccsidDbcSet_ = false;
1011        ccsidDbcEncoding_ = null;
1012    }
1013
1014    boolean isCcsidDbcSet() {
1015        return ccsidDbcSet_;
1016    }
1017
1018    // analyze exception handling some more here
1019
String JavaDoc getCcsidDbcEncoding() throws DisconnectException {
1020        if (ccsidDbcEncoding_ == null) {
1021            ccsidDbcEncoding_ = UTF8ENCODING;
1022        }
1023        return ccsidDbcEncoding_;
1024    }
1025
1026    int getCcsidMbc() {
1027        return ccsidMbc_;
1028    }
1029
1030    void setCcsidMbc(int ccsid) {
1031        ccsidMbc_ = ccsid;
1032        ccsidMbcSet_ = true;
1033        ccsidMbcEncoding_ = null;
1034    }
1035
1036    void clearCcsidMbc() {
1037        ccsidMbc_ = 0;
1038        ccsidMbcSet_ = false;
1039        ccsidMbcEncoding_ = null;
1040    }
1041
1042    boolean isCcsidMbcSet() {
1043        return ccsidMbcSet_;
1044    }
1045
1046    // analyze exception handling some more here
1047
String JavaDoc getCcsidMbcEncoding() throws DisconnectException {
1048        if (ccsidMbcEncoding_ == null) {
1049            ccsidMbcEncoding_ = UTF8ENCODING;
1050        }
1051        return ccsidMbcEncoding_;
1052    }
1053
1054    int getByteOrder() {
1055        return SignedBinary.BIG_ENDIAN;
1056    }
1057
1058    public Object JavaDoc clone() {
1059        try {
1060            return super.clone();
1061        } catch (java.lang.CloneNotSupportedException JavaDoc e) {
1062            return null; // this shouldn't happen since we implement the cloneable interface
1063
}
1064    }
1065
1066    // Populates netCursor descriptors, rename this populateCursorDescriptors()
1067
void updateColumn(NetCursor netCursor,
1068                      int columnIndex,
1069                      int protocolLid,
1070                      int protocolLength) throws DisconnectException {
1071        FdocaSimpleDataArray sda = environmentTables_[protocolLid];
1072
1073        if ((mddOverride_) && (overrideTable_[protocolLid] != null)) {
1074            sda = overrideTable_[protocolLid];
1075        }
1076
1077        if (sda == null) {
1078            netAgent_.accumulateChainBreakingReadExceptionAndThrow(
1079                new DisconnectException(netAgent_,
1080                    new ClientMessageId(SQLState.NET_INVALID_FDOCA_ID)));
1081        }
1082
1083        // 2. Set Null indicator based on PROTOCOL Type.
1084
// Nullable SQL and PROTOCOL types are all odd numbers and the nullable
1085
// type is one number higher than the related non-nullable type.
1086
netCursor.nullable_[columnIndex] = ((sda.protocolType_ % 2) == 1);
1087
1088        // 3. Update CCSID
1089
// The typdef object should store the java encoding,
1090
switch (sda.ccsid_) {
1091        case CCSIDSBC:
1092            netCursor.charsetName_[columnIndex] = getCcsidSbcEncoding();
1093            netCursor.ccsid_[columnIndex] = this.ccsidSbc_;
1094            break;
1095        case CCSIDMBC:
1096            if (isCcsidMbcSet() && (ccsidMbc_ != 0)) {
1097                netCursor.charsetName_[columnIndex] = getCcsidMbcEncoding();
1098                netCursor.ccsid_[columnIndex] = ccsidMbc_;
1099            } else {
1100                // if the server didn't return a mixed byte ccsid, set both the
1101
// encoding and the btc reference to null. see CCSIDDBC comment below.
1102
netCursor.charsetName_[columnIndex] = null;
1103                netCursor.ccsid_[columnIndex] = 0;
1104            }
1105            break;
1106        case CCSIDDBC:
1107            if (isCcsidDbcSet() && (ccsidDbc_ != 0)) {
1108                netCursor.charsetName_[columnIndex] = getCcsidDbcEncoding();
1109                netCursor.ccsid_[columnIndex] = this.ccsidDbc_;
1110            } else {
1111                // if the server didn't return a double byte ccsid, set both the
1112
// encoding and the btc reference to null. later an exception will
1113
// be thrown on the getXXX method. calling the getCcsidDbcEncoding method
1114
// will throw the exception here and this is not desirable.
1115
netCursor.charsetName_[columnIndex] = null;
1116                netCursor.ccsid_[columnIndex] = 0;
1117            }
1118            break;
1119
1120        default: // This default case is used for mdd override ccsids.
1121
// In this case the sda.ccsid_ is the actual native ccsid,
1122
// otherwise the sda.ccsid_ is a placeholder:
1123
// CCSIDMBC, CCSIDDDBC, CCSIDSBC to indicate that
1124
// the actual ccsid is the connection's ccsid (in protocol lingo the connection's typdef ccsid).
1125
netCursor.charsetName_[columnIndex] = UTF8ENCODING;
1126            netCursor.ccsid_[columnIndex] = sda.ccsid_;
1127            break;
1128        }
1129
1130        // 5. Set the length fdoca length.
1131
// For some types this may be a precision and a scale.
1132
// this includes FIXED DECIMAL (PROTOCOL type 0x0E, 0X0F),
1133
// retain the high order placeholder for lobs)
1134
// this includes LARGE OBJECT BYTES (PROTOCOL type 0xC8, 0xC9)
1135
// LARGE OBJECT CHAR SBCS (PROTOCOL type 0xCA, 0xCB)
1136
// LARGE OBJECT CHAR DBCS (PROTOCOL type 0xCC, 0xCD)
1137
// LARGE OBJECT CHAR MIXED (PROTOCOL type 0xCE, 0xCF)
1138
// also set the hasLobs_ flag to true
1139
if ((sda.protocolType_ >= 0xC8) && (sda.protocolType_ <= 0xCF)) {
1140            // retain placeholder information
1141
// right now just set the length...
1142
// probably need to accomodate for the high order placeholder bit
1143
netCursor.fdocaLength_[columnIndex] = protocolLength;
1144            netCursor.hasLobs_ = true;
1145        } else {
1146            netCursor.fdocaLength_[columnIndex] = protocolLength;
1147        }
1148
1149        // 6. Set jdbc type.
1150
netCursor.jdbcTypes_[columnIndex] = protocolToJdbcTypes_[sda.protocolType_];
1151
1152        // 7. Get the number of bytes to read for variable length data.
1153
netCursor.typeToUseForComputingDataLength_[columnIndex] = sda.typeToUseForComputingDataLength_;
1154
1155        // 8. Update the maximumRowSize
1156
// Count : column null indicator +
1157
// column length +
1158
// posibly a 2-byte length for varchar columns
1159
switch (netCursor.typeToUseForComputingDataLength_[columnIndex]) {
1160        case DECIMALLENGTH:
1161            netCursor.maximumRowSize_ += 1 + 16;
1162            break;
1163        case LOBLENGTH:
1164            netCursor.maximumRowSize_ += 1 + (netCursor.fdocaLength_[columnIndex] & 0x7fff);
1165            break;
1166        default:
1167            netCursor.maximumRowSize_ += 1 + netCursor.fdocaLength_[columnIndex] + 2; // 2 is the length indicator for varchar
1168
break;
1169        }
1170
1171        // 9. Get the character size.
1172
if (sda.characterSize_ == 2) {
1173            netCursor.isGraphic_[columnIndex] = true;
1174        }
1175
1176    }
1177
1178    // Called before the code parses a descriptor
1179
void clearMddOverrides() {
1180        if (mddOverride_ == false) {
1181            return;
1182        }
1183
1184        mddOverride_ = false;
1185        for (int i = 0; i < OVERRIDE_TABLE_SIZE; i++) {
1186            overrideTable_[i] = null;
1187        }
1188    }
1189
1190    // Called after the code parses a descriptor
1191
void setMddOverride(int protocolType,
1192                        int fdocaTripletLid,
1193                        int fdocaFieldType,
1194                        int ccsid,
1195                        int characterSize,
1196                        int mode,
1197                        int length) {
1198        mddOverride_ = true;
1199
1200
1201        if (overrideTable_[fdocaTripletLid] == null) {
1202            overrideTable_[fdocaTripletLid] = new FdocaSimpleDataArray
1203                    (protocolType,
1204                            fdocaFieldType,
1205                            fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f],
1206                            ccsid,
1207                            characterSize,
1208                            mode,
1209                            length,
1210                            mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType));
1211        } else {
1212            overrideTable_[fdocaTripletLid].update(protocolType,
1213                    fdocaFieldType,
1214                    fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f],
1215                    ccsid,
1216                    characterSize,
1217                    mode,
1218                    length,
1219                    mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType));
1220        }
1221    }
1222
1223    private int mapFdocaTypeToTypeToUseForComputingDataLength(int fdocaFieldType) {
1224        switch (fdocaFieldType & 0x7f) { // &0x7f masks out the null indicator
1225
case FdocaConstants.FDOCA_TYPE_VARCHAR:
1226        case FdocaConstants.FDOCA_TYPE_VARBYTES:
1227            return Typdef.TWOBYTELENGTH;
1228        case FdocaConstants.FDOCA_TYPE_DECIMAL:
1229        case FdocaConstants.FDOCA_TYPE_NUMERIC_CHAR:
1230            return Typdef.DECIMALLENGTH;
1231        case FdocaConstants.FDOCA_TYPE_LOBBYTES:
1232        case FdocaConstants.FDOCA_TYPE_LOBCHAR:
1233            return Typdef.LOBLENGTH;
1234        case FdocaConstants.FDOCA_TYPE_PSCLBYTE:
1235        case FdocaConstants.FDOCA_TYPE_PSCLCHAR:
1236            return Typdef.ONEBYTELENGTH;
1237        default:
1238            return 0;
1239        }
1240    }
1241}
1242
Popular Tags