0001: /*
0002:
0003: Derby - Class org.apache.derby.client.net.Typdef
0004:
0005: Licensed to the Apache Software Foundation (ASF) under one or more
0006: contributor license agreements. See the NOTICE file distributed with
0007: this work for additional information regarding copyright ownership.
0008: The ASF licenses this file to You under the Apache License, Version 2.0
0009: (the "License"); you may not use this file except in compliance with
0010: the License. You may obtain a copy of the License at
0011:
0012: http://www.apache.org/licenses/LICENSE-2.0
0013:
0014: Unless required by applicable law or agreed to in writing, software
0015: distributed under the License is distributed on an "AS IS" BASIS,
0016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0017: See the License for the specific language governing permissions and
0018: limitations under the License.
0019:
0020: */
0021:
0022: package org.apache.derby.client.net;
0023:
0024: import org.apache.derby.iapi.reference.DRDAConstants;
0025: import org.apache.derby.iapi.reference.JDBC30Translation;
0026: import org.apache.derby.client.am.Cursor;
0027: import org.apache.derby.client.am.DisconnectException;
0028: import org.apache.derby.client.am.SignedBinary;
0029: import org.apache.derby.client.am.ClientMessageId;
0030: import org.apache.derby.shared.common.reference.SQLState;
0031:
0032: //
0033: // General Notes
0034: // Descriptors are overriden using two distinct mechanisms
0035: // - new TYPDEFNAM and TYPDEFOVR specifications which override environmental
0036: // specifications originally established at connect time.
0037: // - MDD/SDA pairs providing specific field level overrides for user data
0038: // not conforming to the TYPDEFNAM and TYPDEFOVR specifications currently
0039: // in effect. Grouping triplets then refer to the new SDAs to specify
0040: // the actual representation of the user data.
0041: // - There are two types of early descriptor triplets, the T and the M triplets.
0042: // Early
0043: // ---------------------------
0044: // Environmental Grp Row Arr
0045: // TTTTTTTTTTTTT MMMMMMMMMMM
0046: // - The T triplets are established by the TYPDEFNAM and TYPDEFOVR values.
0047: // These can be overridden for any command or reply by specifying
0048: // a new value for TYPDEFNAM and TYPDEFOVR.
0049: // - The M triplets are established by the MGRLVL parameter on EXCSAT.
0050: // They define PROTOCOL information units such as the SQLCA.
0051: // These grouping and structuring triplets cannot be overriden
0052: // Any change would mean a change in what information was exchanged
0053: // rather than just how that information would be represented.
0054: // - There are two types of late descriptor triplets, the O and U triplets.
0055: // Late
0056: // ---------------------------
0057: // Environmental Grp Row Arr
0058: // OOOOOOOOOOOOO UUUUUUUUUUU
0059: // - The O triplets provide specific overrides.
0060: // - The U triplets define actual user data, sometimes in combination
0061: // with PROTOCOL information units. The U triplets reference O triplets
0062: // and both T triplets and M triplets (which in turn reference T triplets).
0063: // - Rules for assigning LIDs to O triplets
0064: // - select LID within range of 1 to 255.
0065: // - select LID which doesn't interfere with references to early triplets
0066: // or O triplets.
0067: //
0068: // requirements
0069: // - if this object handles overrides, they are only in effect for one
0070: // command or the reply to one command. Make sure that the correct
0071: // "in effect" overrides are used especially when MDD overrides are present.
0072: // - raise error if no CCSIDMBC or CCSIDDBC has been specified for mixed or
0073: // double byte data. Return SQLSTATE 57017 with 0 as source CCSID token.
0074: // Possible errors:
0075: // - check for valid lid at SQLAM level.
0076: // - if the lid is greater than the max
0077: // supported lid then the descriptor is invalid for the supported SQLAM level.
0078: // Error Checking and Reporting Notes taken from PROTOCOL manual.
0079: // - If the receiver of an FDODSC finds it in error, the error must
0080: // be reported with a DDM message DSCINVRM. If the descriptor
0081: // passes PROTOCOL validity checks, but the data does not match the
0082: // descriptors, the mismatch must be reported with a DDM message DTAMCHRM.
0083: // so descriptor must be correct and valid and then the data must match
0084: // the descriptor.
0085: // - Possible General Errors
0086: // - 01 FD:OCA Triplet not used in PROTOCOL descriptors or Type code invalid.
0087: // - 02 Triplet Sequence Error: the two possible sequences are:
0088: // 1.) GDA,(CPT,)RLO<,RLO><== normal case with no overrrides
0089: // 2.) MDD,SDA,(MDD,SDA,)MDD,GDA,(CPT,)\
0090: // MDD,RLO<,MDD,RLO>
0091: // where () indicates an optional repeating group and <> indicates
0092: // a field allowed only when arrays are expected.
0093: // - 03 An array description is required, and this one does not
0094: // describe an array (probably too many or too few RLO triplets).
0095: // - 04 A row description is required, and this one does not describe a row
0096: // probably too many or too few RLO triplets.
0097: // - 05 Late Environmental Descriptor just received not supported (probably
0098: // due to non-support of requested overrides).
0099: // - 06 Malformed triplet; missing required parameter.
0100: // - 07 Parameter value not acceptable.
0101: // - Possible MDD Errors
0102: // - 11 MDD present is not recognized as PROTOCOL Descriptor
0103: // - 12 MDD class not recognized as valid PROTOCOL class.
0104: // - 13 MDD type not recognized as valid PROTOCOL type.
0105: // - Possible SDA Errors
0106: // - 21 Representation incompatible with PROTOCOL type (in prior MDD).
0107: // - 22 CCSID not supported
0108: // - Possible GDA/CPT Errors
0109: // - 32 GDA references a LID that is not an SDA or GDA.
0110: // - 33 GDA length override exceeds limits.
0111: // - 34 GDA precision exceeds limits.
0112: // - 35 GDA scale > precision or scale negative
0113: // - 36 GDA length override missing or incompatible with protocol type.
0114: // - Possible RLO Errors
0115: // - 41 RLO references a LID that is not an RLO or GDA
0116: // - 42 RLO fails to reference a required GDA or RLO (for example, QRYDSC
0117: // must include a reference to SQLCAGRP).
0118: //
0119: // Nullable SQL and PROTOCOL types are all odd numbers and nullable type is
0120: // one number higher than the related non-nullable type
0121: //
0122: // earlyTTriplets
0123: // late0Triplets
0124: //
0125: // typdef end
0126:
0127: public class Typdef implements java.lang.Cloneable {
0128: //---------------------navigational members-----------------------------------
0129:
0130: //-----------------------------state------------------------------------------
0131:
0132: // double byte character set
0133: static final short CCSIDDBC = 1;
0134:
0135: // multi-byte character set
0136: static final short CCSIDMBC = 2;
0137:
0138: // single byte character set
0139: static final short CCSIDSBC = 3;
0140:
0141: // No CCSID
0142: static final short NOCCSID = 0;
0143:
0144: // fixed length
0145: static final short FIXEDLENGTH = 0;
0146:
0147: // 2-byte variable length
0148: static final short TWOBYTELENGTH = 1;
0149:
0150: // 1-byte variable length
0151: static final short ONEBYTELENGTH = 2;
0152:
0153: // decimal length
0154: static final short DECIMALLENGTH = 3;
0155:
0156: // lob length
0157: static final short LOBLENGTH = 4;
0158:
0159: public static final String UTF8ENCODING = "UTF8";
0160:
0161: private static final int OVERRIDE_TABLE_SIZE = 0xff;
0162:
0163: private static final int[] fdocaTypeToRepresentationMap_ = {
0164: /* 0x00 */0,
0165: /* 0x01 */Cursor.BYTES, /* FDOCA_TYPE_FIXEDBYTES */
0166: /* 0x02 */Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARBYTES */
0167: /* 0x03 */Cursor.NULL_TERMINATED_BYTES, /* FDOCA_TYPE_NTBYTES */
0168: /* 0x04 */0,
0169: /* 0x05 */0,
0170: /* 0x06 */0,
0171: /* 0x07 */Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLBYTE */
0172: /* 0x08 */0,
0173: /* 0x09 */0,
0174: /* 0x0A */0,
0175: /* 0x0B */0,
0176: /* 0x0C */0,
0177: /* 0x0D */0,
0178: /* 0x0E */0,
0179: /* 0x0F */0,
0180: /* 0x10 */Cursor.STRING, /* FDOCA_TYPE_FIXEDCHAR */
0181: /* 0x11 */Cursor.VARIABLE_STRING, /* FDOCA_TYPE_VARCHAR */
0182: /* 0x12 */0,
0183: /* 0x13 */0,
0184: /* 0x14 */Cursor.NULL_TERMINATED_STRING, /* FDOCA_TYPE_NTCHAR */
0185: /* 0x15 */0,
0186: /* 0x16 */0,
0187: /* 0x17 */0,
0188: /* 0x18 */0,
0189: /* 0x19 */Cursor.VARIABLE_SHORT_STRING, /* FDOCA_TYPE_PSCLCHAR */
0190: /* 0x1A */0,
0191: /* 0x1B */0,
0192: /* 0x1C */0,
0193: /* 0x1D */0,
0194: /* 0x1E */0,
0195: /* 0x1F */0,
0196: /* 0x20 */0,
0197: /* 0x21 */0,
0198: /* 0x22 */0,
0199: /* 0x23 */SignedBinary.BIG_ENDIAN, /* FDOCA_TYPE_INTEGER_BE */
0200: /* 0x24 */SignedBinary.LITTLE_ENDIAN, /* FDOCA_TYPE_INTEGER_LE */
0201: /* 0x25 */0,
0202: /* 0x26 */0,
0203: /* 0x27 */0,
0204: /* 0x28 */0,
0205: /* 0x29 */0,
0206: /* 0x2A */0,
0207: /* 0x2B */0,
0208: /* 0x2C */0,
0209: /* 0x2D */0,
0210: /* 0x2E */0,
0211: /* 0x2F */0,
0212: /* 0x30 */org.apache.derby.client.am.Decimal.PACKED_DECIMAL, /* FDOCA_TYPE_DECIMAL */
0213: /* 0x31 */0,
0214: /* 0x32 */0,
0215: /* 0x33 */0,
0216: /* 0x34 */0,
0217: /* 0x35 */0,
0218: /* 0x36 */0,
0219: /* 0x37 */0,
0220: /* 0x38 */0,
0221: /* 0x39 */0,
0222: /* 0x3A */0,
0223: /* 0x3B */0,
0224: /* 0x3C */0,
0225: /* 0x3D */0,
0226: /* 0x3E */0,
0227: /* 0x3F */0,
0228: /* 0x40 */0,
0229: /* 0x41 */0,
0230: /* 0x42 */0,
0231: /* 0x43 */0,
0232: /* 0x44 */0,
0233: /* 0x45 */0,
0234: /* 0x46 */0,
0235: /* 0x47 */0,
0236: /* 0x48 */org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, /* FDOCA_TYPE_FLOAT_IEEE */
0237: /* 0x49 */0,
0238: /* 0x4A */0,
0239: /* 0x4B */0,
0240: /* 0x4C */0,
0241: /* 0x4D */0,
0242: /* 0x4E */0,
0243: /* 0x4F */0,
0244: /* 0x50 */0, /* FDOCA_TYPE_LOBBYTES */// is 0 correct
0245: /* 0x51 */0, /* FDOCA_TYPE_LOBCHAR */// is 0 correct
0246: /* 0x52 */0,
0247: /* 0x53 */0,
0248: /* 0x54 */0,
0249: /* 0x55 */0,
0250: /* 0x56 */0,
0251: /* 0x57 */0,
0252: /* 0x58 */0,
0253: /* 0x59 */0,
0254: /* 0x5A */0,
0255: /* 0x5B */0,
0256: /* 0x5C */0,
0257: /* 0x5D */0,
0258: /* 0x5E */0,
0259: /* 0x5F */0 };
0260:
0261: //
0262: // FIXME: Instead of magic numbers, the first arg in each of these
0263: // constructor calls should be the corresponding constant from
0264: // DRDAConstants.
0265: //
0266: protected static final FdocaSimpleDataArray[] environmentTables_ = {
0267: /* 0x00 Empties */
0268: null,
0269: /* 0x01 Empties */
0270: null,
0271: /* 0x02 4-byte int */
0272: new FdocaSimpleDataArray(0x02,
0273: FdocaConstants.FDOCA_TYPE_INTEGER_BE,
0274: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4,
0275: FIXEDLENGTH),
0276: /* 0x03 null 4-byte int */
0277: new FdocaSimpleDataArray(0x03,
0278: FdocaConstants.FDOCA_TYPE_NINTEGER_BE,
0279: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4,
0280: FIXEDLENGTH),
0281: /* 0x04 2-byte int */
0282: new FdocaSimpleDataArray(0x04,
0283: FdocaConstants.FDOCA_TYPE_INTEGER_BE,
0284: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2,
0285: FIXEDLENGTH),
0286: /* 0x05 null 2-byte int */
0287: new FdocaSimpleDataArray(0x05,
0288: FdocaConstants.FDOCA_TYPE_NINTEGER_BE,
0289: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2,
0290: FIXEDLENGTH),
0291: /* 0x06 1-byte int */
0292: new FdocaSimpleDataArray(0x06,
0293: FdocaConstants.FDOCA_TYPE_INTEGER_BE,
0294: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1,
0295: FIXEDLENGTH),
0296: /* 0x07 null 1-byte int */
0297: new FdocaSimpleDataArray(0x07,
0298: FdocaConstants.FDOCA_TYPE_NINTEGER_BE,
0299: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1,
0300: FIXEDLENGTH),
0301: /* 0x08 16-byte bin float */
0302: new FdocaSimpleDataArray(
0303: 0x08,
0304: FdocaConstants.FDOCA_TYPE_FLOAT_IEEE,
0305: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0306: NOCCSID, 0, 0, 16, FIXEDLENGTH),
0307: /* 0x09 null 16-byte bin float */
0308: new FdocaSimpleDataArray(
0309: 0x09,
0310: FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE,
0311: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0312: NOCCSID, 0, 0, 16, FIXEDLENGTH),
0313: /* 0x0A 8-byte bin float */
0314: new FdocaSimpleDataArray(
0315: 0x0A,
0316: FdocaConstants.FDOCA_TYPE_FLOAT_IEEE,
0317: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0318: NOCCSID, 0, 0, 8, FIXEDLENGTH),
0319: /* 0x0B null 8-byte bin float */
0320: new FdocaSimpleDataArray(
0321: 0x0B,
0322: FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE,
0323: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0324: NOCCSID, 0, 0, 8, FIXEDLENGTH),
0325: /* 0x0C 4-byte bin float */
0326: new FdocaSimpleDataArray(
0327: 0x0C,
0328: FdocaConstants.FDOCA_TYPE_FLOAT_IEEE,
0329: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0330: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0331: /* 0x0D null 4-byte bin float */
0332: new FdocaSimpleDataArray(
0333: 0x0D,
0334: FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE,
0335: org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT,
0336: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0337: /* 0x0E Fixed Decimal */
0338: new FdocaSimpleDataArray(0x0E,
0339: FdocaConstants.FDOCA_TYPE_DECIMAL,
0340: org.apache.derby.client.am.Decimal.PACKED_DECIMAL,
0341: NOCCSID, 0, 0, 31, DECIMALLENGTH),
0342: /* 0x0F null Fixed Decimal */
0343: new FdocaSimpleDataArray(0x0F,
0344: FdocaConstants.FDOCA_TYPE_NDECIMAL,
0345: org.apache.derby.client.am.Decimal.PACKED_DECIMAL,
0346: NOCCSID, 0, 0, 31, DECIMALLENGTH),
0347: /* 0x10 empties */
0348: null,
0349: /* 0x11 empties */
0350: null,
0351: /* 0x12 Numeric */
0352: null,
0353: /* 0x13 null Numeric */
0354: null,
0355: /* 0x14 Empties */
0356: null,
0357: /* 0x15 Empties */
0358: null,
0359: /* 0x16 Big int */
0360: new FdocaSimpleDataArray(0x16,
0361: FdocaConstants.FDOCA_TYPE_INTEGER_BE,
0362: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8,
0363: FIXEDLENGTH),
0364: /* 0x17 null Big int */
0365: new FdocaSimpleDataArray(0x17,
0366: FdocaConstants.FDOCA_TYPE_NINTEGER_BE,
0367: SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8,
0368: FIXEDLENGTH),
0369: /* 0x18 Large Obj Bytes Loc */
0370: new FdocaSimpleDataArray(0x18,
0371: FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00,
0372: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0373: /* 0x19 null Large Obj Bytes Loc */
0374: new FdocaSimpleDataArray(0x19,
0375: FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00,
0376: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0377: /* 0x1A Empties */
0378: null,
0379: /* 0x1B null Large Obj Char Loc */
0380: new FdocaSimpleDataArray(0x1B,
0381: FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00,
0382: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0383: /* 0x1C Large Obj Char DBCS Loc */
0384: new FdocaSimpleDataArray(0x1C,
0385: FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00,
0386: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0387: /* 0x1D null Large Obj Char DBCS Loc */
0388: new FdocaSimpleDataArray(0x1D,
0389: FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00,
0390: NOCCSID, 0, 0, 4, FIXEDLENGTH),
0391: /* 0x1E Row Identifier */
0392: new FdocaSimpleDataArray(0x1E,
0393: FdocaConstants.FDOCA_TYPE_VARBYTES,
0394: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40,
0395: TWOBYTELENGTH),
0396: /* 0x1F null Row Identifier */
0397: new FdocaSimpleDataArray(0x1F,
0398: FdocaConstants.FDOCA_TYPE_NVARBYTES,
0399: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40,
0400: TWOBYTELENGTH),
0401: /* 0x20 Date */
0402: new FdocaSimpleDataArray(0x20,
0403: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING,
0404: CCSIDSBC, 1, 0, 10, FIXEDLENGTH),
0405: /* 0x21 null Date */
0406: new FdocaSimpleDataArray(0x21,
0407: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR,
0408: Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH),
0409: /* 0x22 Time */
0410: new FdocaSimpleDataArray(0x22,
0411: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING,
0412: CCSIDSBC, 1, 0, 8, FIXEDLENGTH),
0413: /* 0x23 null Time */
0414: new FdocaSimpleDataArray(0x23,
0415: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR,
0416: Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH),
0417: /* 0x24 Timestamp */
0418: new FdocaSimpleDataArray(0x24,
0419: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING,
0420: CCSIDSBC, 1, 0, 26, FIXEDLENGTH),
0421: /* 0x25 null Timestamp */
0422: new FdocaSimpleDataArray(0x25,
0423: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR,
0424: Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH),
0425: /* 0x26 Fixed bytes */
0426: new FdocaSimpleDataArray(0x26,
0427: FdocaConstants.FDOCA_TYPE_FIXEDBYTES, Cursor.BYTES,
0428: NOCCSID, 0, 0, 32767, FIXEDLENGTH),
0429: /* 0x27 null Fixed bytes */
0430: new FdocaSimpleDataArray(0x27,
0431: FdocaConstants.FDOCA_TYPE_NFIXEDBYTES,
0432: Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH),
0433: /* 0x28 Variable bytes */
0434: new FdocaSimpleDataArray(0x28,
0435: FdocaConstants.FDOCA_TYPE_VARBYTES,
0436: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767,
0437: TWOBYTELENGTH),
0438: /* 0x29 null Variable bytes */
0439: new FdocaSimpleDataArray(0x29,
0440: FdocaConstants.FDOCA_TYPE_NVARBYTES,
0441: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767,
0442: TWOBYTELENGTH),
0443: /* 0x2A Long var bytes */
0444: new FdocaSimpleDataArray(0x2A,
0445: FdocaConstants.FDOCA_TYPE_VARBYTES,
0446: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767,
0447: TWOBYTELENGTH),
0448: /* 0x2B null Long var bytes */
0449: new FdocaSimpleDataArray(0x2B,
0450: FdocaConstants.FDOCA_TYPE_NVARBYTES,
0451: Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767,
0452: TWOBYTELENGTH),
0453: /* 0x2C Nullterm bytes */
0454: new FdocaSimpleDataArray(0x2C,
0455: FdocaConstants.FDOCA_TYPE_NTBYTES,
0456: Cursor.NULL_TERMINATED_BYTES, NOCCSID, 0, 1, 32767,
0457: FIXEDLENGTH),
0458: /* 0x2D null Nullterm bytes */
0459: new FdocaSimpleDataArray(0x2D,
0460: FdocaConstants.FDOCA_TYPE_NNTBYTES,
0461: Cursor.NULL_TERMINATED_STRING, NOCCSID, 0, 1,
0462: 32767, FIXEDLENGTH),
0463: /* 0x2E Nullterm SBCS */
0464: new FdocaSimpleDataArray(0x2E,
0465: FdocaConstants.FDOCA_TYPE_NTCHAR,
0466: Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1,
0467: 32767, FIXEDLENGTH),
0468: /* 0x2F null Nullterm SBCS */
0469: new FdocaSimpleDataArray(0x2F,
0470: FdocaConstants.FDOCA_TYPE_NNTCHAR,
0471: Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1,
0472: 32767, FIXEDLENGTH),
0473: /* 0x30 Fix char SBCS */
0474: new FdocaSimpleDataArray(0x30,
0475: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING,
0476: CCSIDSBC, 1, 0, 32767, FIXEDLENGTH),
0477: /* 0x31 null Fix char SBCS */
0478: new FdocaSimpleDataArray(0x31,
0479: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR,
0480: Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH),
0481: /* 0x32 Var char SBCS */
0482: new FdocaSimpleDataArray(0x32,
0483: FdocaConstants.FDOCA_TYPE_VARCHAR,
0484: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0485: TWOBYTELENGTH),
0486: /* 0x33 null Var char SBCS */
0487: new FdocaSimpleDataArray(0x33,
0488: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0489: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0490: TWOBYTELENGTH),
0491: /* 0x34 Long var SBCS */
0492: new FdocaSimpleDataArray(0x34,
0493: FdocaConstants.FDOCA_TYPE_VARCHAR,
0494: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0495: TWOBYTELENGTH),
0496: /* 0x35 null Long var SBCS */
0497: new FdocaSimpleDataArray(0x35,
0498: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0499: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0500: TWOBYTELENGTH),
0501: /* 0x36 Fix char DBCS */
0502: new FdocaSimpleDataArray(0x36,
0503: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00,
0504: CCSIDDBC, 2, 0, 16383, FIXEDLENGTH),
0505: /* 0x37 null Fix char DBCS */
0506: new FdocaSimpleDataArray(0x37,
0507: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00,
0508: CCSIDDBC, 2, 0, 16383, FIXEDLENGTH),
0509: /* 0x38 Var char DBCS */
0510: new FdocaSimpleDataArray(0x38,
0511: FdocaConstants.FDOCA_TYPE_VARCHAR,
0512: Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383,
0513: TWOBYTELENGTH),
0514: /* 0x39 null Var char DBCS */
0515: new FdocaSimpleDataArray(0x39,
0516: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0517: Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383,
0518: TWOBYTELENGTH),
0519: /* 0x3A Long var DBCS */
0520: new FdocaSimpleDataArray(0x3A,
0521: FdocaConstants.FDOCA_TYPE_VARCHAR,
0522: Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383,
0523: TWOBYTELENGTH),
0524: /* 0x3B null Long var DBCS */
0525: new FdocaSimpleDataArray(0x3B,
0526: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0527: Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383,
0528: TWOBYTELENGTH),
0529: /* 0x3C Fix char MBCS */
0530: new FdocaSimpleDataArray(0x3C,
0531: FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00,
0532: CCSIDMBC, 1, 0, 32767, FIXEDLENGTH),
0533: /* 0x3D null Fix char MBCS */
0534: new FdocaSimpleDataArray(0x3D,
0535: FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00,
0536: CCSIDMBC, 1, 0, 32767, FIXEDLENGTH),
0537: /* 0x3E Var char MBCS */
0538: new FdocaSimpleDataArray(0x3E,
0539: FdocaConstants.FDOCA_TYPE_VARCHAR,
0540: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0541: TWOBYTELENGTH),
0542: /* 0x3F null Var char MBCS */
0543: new FdocaSimpleDataArray(0x3F,
0544: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0545: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0546: TWOBYTELENGTH),
0547: /* 0x40 Long var MBCS */
0548: new FdocaSimpleDataArray(0x40,
0549: FdocaConstants.FDOCA_TYPE_VARCHAR,
0550: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0551: TWOBYTELENGTH),
0552: /* 0x41 null Long var MBCS */
0553: new FdocaSimpleDataArray(0x41,
0554: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0555: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0556: TWOBYTELENGTH),
0557: /* 0x42 Nullterm MBCS */
0558: new FdocaSimpleDataArray(0x42,
0559: FdocaConstants.FDOCA_TYPE_NTCHAR,
0560: Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1,
0561: 32767, FIXEDLENGTH),
0562: /* 0x43 null Nullterm MBCS */
0563: new FdocaSimpleDataArray(0x43,
0564: FdocaConstants.FDOCA_TYPE_NNTCHAR,
0565: Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1,
0566: 32767, FIXEDLENGTH),
0567: /* 0x44 L String bytes */
0568: new FdocaSimpleDataArray(0x44,
0569: FdocaConstants.FDOCA_TYPE_PSCLBYTE,
0570: Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255,
0571: ONEBYTELENGTH),
0572: /* 0x45 null L String bytes */
0573: new FdocaSimpleDataArray(0x45,
0574: FdocaConstants.FDOCA_TYPE_NPSCLBYTE,
0575: Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255,
0576: ONEBYTELENGTH),
0577: /* 0x46 L String SBCS */
0578: new FdocaSimpleDataArray(0x46,
0579: FdocaConstants.FDOCA_TYPE_PSCLCHAR,
0580: Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255,
0581: ONEBYTELENGTH),
0582: /* 0x47 null L String SBCS */
0583: new FdocaSimpleDataArray(0x47,
0584: FdocaConstants.FDOCA_TYPE_NPSCLCHAR,
0585: Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255,
0586: ONEBYTELENGTH),
0587: /* 0x48 L String MBCS */
0588: new FdocaSimpleDataArray(0x48,
0589: FdocaConstants.FDOCA_TYPE_PSCLCHAR,
0590: Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255,
0591: ONEBYTELENGTH),
0592: /* 0x49 null L String MBCS */
0593: new FdocaSimpleDataArray(0x49,
0594: FdocaConstants.FDOCA_TYPE_NPSCLCHAR,
0595: Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255,
0596: ONEBYTELENGTH),
0597: /* 0x4A Empties */
0598: null,
0599: /* 0x4B Empties */
0600: null,
0601: /* 0x4C SBCS */
0602: new FdocaSimpleDataArray(0x4C,
0603: FdocaConstants.FDOCA_TYPE_VARCHAR,
0604: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0605: TWOBYTELENGTH),
0606: /* 0x4D null SBCS */
0607: new FdocaSimpleDataArray(0x4D,
0608: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0609: Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767,
0610: TWOBYTELENGTH),
0611: /* 0x4E MBCS */
0612: new FdocaSimpleDataArray(0x4E,
0613: FdocaConstants.FDOCA_TYPE_VARCHAR,
0614: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0615: TWOBYTELENGTH),
0616: /* 0x4F null MBCS */
0617: new FdocaSimpleDataArray(0x4F,
0618: FdocaConstants.FDOCA_TYPE_NVARCHAR,
0619: Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767,
0620: TWOBYTELENGTH),
0621: /* 0x50 Empties */
0622: null,
0623: /* 0x51 Empties */
0624: null,
0625: /* 0x52 Empties */
0626: null,
0627: /* 0x53 Empties */
0628: null,
0629: /* 0x54 Empties */
0630: null,
0631: /* 0x55 Empties */
0632: null,
0633: /* 0x56 Empties */
0634: null,
0635: /* 0x57 Empties */
0636: null,
0637: /* 0x58 Empties */
0638: null,
0639: /* 0x59 Empties */
0640: null,
0641: /* 0x5A Empties */
0642: null,
0643: /* 0x5B Empties */
0644: null,
0645: /* 0x5C Empties */
0646: null,
0647: /* 0x5D Empties */
0648: null,
0649: /* 0x5E Empties */
0650: null,
0651: /* 0x5F Empties */
0652: null,
0653: /* 0x60 Empties */
0654: null,
0655: /* 0x61 Empties */
0656: null,
0657: /* 0x62 Empties */
0658: null,
0659: /* 0x63 Empties */
0660: null,
0661: /* 0x64 Empties */
0662: null,
0663: /* 0x65 Empties */
0664: null,
0665: /* 0x66 Empties */
0666: null,
0667: /* 0x67 Empties */
0668: null,
0669: /* 0x68 Empties */
0670: null,
0671: /* 0x69 Empties */
0672: null,
0673: /* 0x6A Empties */
0674: null,
0675: /* 0x6B Empties */
0676: null,
0677: /* 0x6C Empties */
0678: null,
0679: /* 0x6D Empties */
0680: null,
0681: /* 0x6E Empties */
0682: null,
0683: /* 0x6F Empties */
0684: null,
0685: /* 0x70 Empties */
0686: null,
0687: /* 0x71 Empties */
0688: null,
0689: /* 0x72 Empties */
0690: null,
0691: /* 0x73 Empties */
0692: null,
0693: /* 0x74 Empties */
0694: null,
0695: /* 0x75 Empties */
0696: null,
0697: /* 0x76 Empties */
0698: null,
0699: /* 0x77 Empties */
0700: null,
0701: /* 0x78 Empties */
0702: null,
0703: /* 0x79 Empties */
0704: null,
0705: /* 0x7A Empties */
0706: null,
0707: /* 0x7B Empties */
0708: null,
0709: /* 0x7C Empties */
0710: null,
0711: /* 0x7D Empties */
0712: null,
0713: /* 0x7E Empties */
0714: null,
0715: /* 0x7F Empties */
0716: null,
0717: /* 0x80 Empties */
0718: null,
0719: /* 0x81 Empties */
0720: null,
0721: /* 0x82 Empties */
0722: null,
0723: /* 0x83 Empties */
0724: null,
0725: /* 0x84 Empties */
0726: null,
0727: /* 0x85 Empties */
0728: null,
0729: /* 0x86 Empties */
0730: null,
0731: /* 0x87 Empties */
0732: null,
0733: /* 0x88 Empties */
0734: null,
0735: /* 0x89 Empties */
0736: null,
0737: /* 0x8A Empties */
0738: null,
0739: /* 0x8B Empties */
0740: null,
0741: /* 0x8C Empties */
0742: null,
0743: /* 0x8D Empties */
0744: null,
0745: /* 0x8E Empties */
0746: null,
0747: /* 0x8F Empties */
0748: null,
0749: /* 0x90 Empties */
0750: null,
0751: /* 0x91 Empties */
0752: null,
0753: /* 0x92 Empties */
0754: null,
0755: /* 0x93 Empties */
0756: null,
0757: /* 0x94 Empties */
0758: null,
0759: /* 0x95 Empties */
0760: null,
0761: /* 0x96 Empties */
0762: null,
0763: /* 0x97 Empties */
0764: null,
0765: /* 0x98 Empties */
0766: null,
0767: /* 0x99 Empties */
0768: null,
0769: /* 0x9A Empties */
0770: null,
0771: /* 0x9B Empties */
0772: null,
0773: /* 0x9C Empties */
0774: null,
0775: /* 0x9D Empties */
0776: null,
0777: /* 0x9E Empties */
0778: null,
0779: /* 0x9F Empties */
0780: null,
0781: /* 0xA0 Empties */
0782: null,
0783: /* 0xA1 Empties */
0784: null,
0785: /* 0xA2 Empties */
0786: null,
0787: /* 0xA3 Empties */
0788: null,
0789: /* 0xA4 Empties */
0790: null,
0791: /* 0xA5 Empties */
0792: null,
0793: /* 0xA6 Empties */
0794: null,
0795: /* 0xA7 Empties */
0796: null,
0797: /* 0xA8 Empties */
0798: null,
0799: /* 0xA9 Empties */
0800: null,
0801: /* 0xAA Empties */
0802: null,
0803: /* 0xAB Empties */
0804: null,
0805: /* 0xAC Empties */
0806: null,
0807: /* 0xAD Empties */
0808: null,
0809: /* 0xAE Empties */
0810: null,
0811: /* 0xAF Empties */
0812: null,
0813: /* 0xB0 Empties */
0814: null,
0815: /* 0xB1 Empties */
0816: null,
0817: /* 0xB2 Empties */
0818: null,
0819: /* 0xB3 Empties */
0820: null,
0821: /* 0xB4 Empties */
0822: null,
0823: /* 0xB5 Empties */
0824: null,
0825: /* 0xB6 Empties */
0826: null,
0827: /* 0xB7 Empties */
0828: null,
0829: /* 0xB8 Empties */
0830: null,
0831: /* 0xB9 Empties */
0832: null,
0833: /* 0xBA Empties */
0834: null,
0835: /* 0xBB Empties */
0836: null,
0837: /* 0xBC Empties */
0838: null,
0839: /* 0xBD Empties */
0840: null,
0841: /* 0xBE Empties */
0842: null,
0843: /* 0xBF Empties */
0844: null,
0845: /* 0xC0 Empties */
0846: null,
0847: /* 0xC1 Empties */
0848: null,
0849: /* 0xC2 Empties */
0850: null,
0851: /* 0xC3 Empties */
0852: null,
0853: /* 0xC4 Empties */
0854: null,
0855: /* 0xC5 Empties */
0856: null,
0857: /* 0xC6 Empties */
0858: null,
0859: /* 0xC7 Empties */
0860: null,
0861: /* 0xC8 Large object bytes */
0862: new FdocaSimpleDataArray(0xC8,
0863: FdocaConstants.FDOCA_TYPE_LOBBYTES, 0x00, NOCCSID,
0864: 0, 1, 8, LOBLENGTH),
0865: /* 0xC9 null Large object bytes */
0866: new FdocaSimpleDataArray(0xC9,
0867: FdocaConstants.FDOCA_TYPE_NLOBBYTES, 0x00, NOCCSID,
0868: 0, 1, 8, LOBLENGTH),
0869: /* 0xCA Large object char SBCS */
0870: new FdocaSimpleDataArray(0xCA,
0871: FdocaConstants.FDOCA_TYPE_LOBCHAR,
0872: Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH),
0873: /* 0xCB null Large object char SBCS */
0874: new FdocaSimpleDataArray(0xCB,
0875: FdocaConstants.FDOCA_TYPE_NLOBCHAR,
0876: Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH),
0877: /* 0xCC Large object char DBCS */
0878: new FdocaSimpleDataArray(0xCC,
0879: FdocaConstants.FDOCA_TYPE_LOBCHAR,
0880: Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH),
0881: /* 0xCD null Large object char DBCS */
0882: new FdocaSimpleDataArray(0xCD,
0883: FdocaConstants.FDOCA_TYPE_NLOBCHAR,
0884: Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH),
0885: /* 0xCE Large object char MBCS */
0886: new FdocaSimpleDataArray(0xCE,
0887: FdocaConstants.FDOCA_TYPE_LOBCHAR,
0888: Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH),
0889: /* 0xCF null Large object char MBCS */
0890: new FdocaSimpleDataArray(0xCF,
0891: FdocaConstants.FDOCA_TYPE_NLOBCHAR,
0892: Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH), };
0893:
0894: private static final int[] protocolToJdbcTypes_ = {
0895: 0x00, // 0x00 Empties
0896: 0x00, // 0x01 Empties
0897: java.sql.Types.INTEGER, // 0x02 4-byte int
0898: java.sql.Types.INTEGER, // 0x03 null 4-byte int
0899: java.sql.Types.SMALLINT, // 0x04 2-byte int
0900: java.sql.Types.SMALLINT, // 0x05 null 2-byte int
0901: java.sql.Types.TINYINT, // 0x06 1-byte int
0902: java.sql.Types.TINYINT, // 0x07 null 1-byte int
0903: java.sql.Types.DECIMAL, // 0x08 16-byte bin float
0904: java.sql.Types.DECIMAL, // 0x09 null 16-byte bin float
0905: java.sql.Types.DOUBLE, // 0x0A 8-byte bin float
0906: java.sql.Types.DOUBLE, // 0x0B null 8-byte bin float
0907: java.sql.Types.REAL, // 0x0C 4-byte bin float
0908: java.sql.Types.REAL, // 0x0D null 4-byte bin float
0909: java.sql.Types.DECIMAL, // 0x0E Fixed Decimal
0910: java.sql.Types.DECIMAL, // 0x0F null Fixed Decimal
0911: java.sql.Types.DECIMAL, // 0x10 Zone Decimal
0912: java.sql.Types.DECIMAL, // 0x11 null Zone Decimal
0913: java.sql.Types.DECIMAL, // 0x12 Numeirc
0914: java.sql.Types.DECIMAL, // 0x13 null Numeric
0915: 0x00, // 0x14 Empties
0916: 0x00, // 0x15 Empties
0917: java.sql.Types.BIGINT, // 0x16 Big int
0918: java.sql.Types.BIGINT, // 0x17 null Big int
0919: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0920: java.sql.Types.DATE, // 0x20 Date
0921: java.sql.Types.DATE, // 0x21 null Date
0922: java.sql.Types.TIME, // 0x22 Time
0923: java.sql.Types.TIME, // 0x23 null Time
0924: java.sql.Types.TIMESTAMP, // 0x24 Timestamp
0925: java.sql.Types.TIMESTAMP, // 0x25 null Timestamp
0926: java.sql.Types.BINARY, // 0x26 Fixed bytes
0927: java.sql.Types.BINARY, // 0x27 null Fixed bytes
0928: java.sql.Types.VARBINARY, // 0x28 Variable bytes
0929: java.sql.Types.VARBINARY, // 0x29 null Variable bytes
0930: java.sql.Types.LONGVARBINARY, // 0x2A Long var bytes
0931: java.sql.Types.LONGVARBINARY, // 0x2B null Long var bytes
0932: java.sql.Types.VARBINARY, // 0x2C Nullterm bytes
0933: java.sql.Types.VARBINARY, // 0x2D null Nullterm bytes
0934: java.sql.Types.CHAR, // 0x2E Nullterm SBCS
0935: java.sql.Types.CHAR, // 0x2F null Nullterm SBCS
0936: java.sql.Types.CHAR, // 0x30 Fix char SBCS
0937: java.sql.Types.CHAR, // 0x31 null Fix char SBCS
0938: java.sql.Types.VARCHAR, // 0x32 Var char SBCS
0939: java.sql.Types.VARCHAR, // 0x33 null Var char SBCS
0940: java.sql.Types.LONGVARCHAR, // 0x34 Long var SBCS
0941: java.sql.Types.LONGVARCHAR, // 0x35 null Long var SBCS
0942: 0x00, // 0x36 Empties
0943: 0x00, // 0x37 Empties
0944: 0x00, // 0x38 Empties
0945: 0x00, // 0x39 Empties
0946: 0x00, // 0x3A Empties
0947: 0x00, // 0x3B Empties
0948: // The following will have to be changed later for situations where
0949: java.sql.Types.CHAR, // 0x3C Fix char MBCS
0950: java.sql.Types.CHAR, // 0x3D null Fix char MBCS
0951: java.sql.Types.VARCHAR, // 0x3E Var char MBCS
0952: java.sql.Types.VARCHAR, // 0x3F null Var char MBCS
0953: java.sql.Types.LONGVARCHAR, // 0x40 Long var MBCS
0954: java.sql.Types.LONGVARCHAR, // 0x41 null Long var MBCS
0955: java.sql.Types.CHAR, // 0x42 Nullterm MBCS
0956: java.sql.Types.CHAR, // 0x43 null Nullterm MBCS
0957: java.sql.Types.VARBINARY, // 0x44 L String bytes
0958: java.sql.Types.VARBINARY, // 0x45 null L String bytes
0959: java.sql.Types.VARCHAR, // 0x46 L String SBCS
0960: java.sql.Types.VARCHAR, // 0x47 null L String SBCS
0961: java.sql.Types.VARCHAR, // 0x48 L String MBCS
0962: java.sql.Types.VARCHAR, // 0x49 null L String MBCS
0963: 0x00, // 0x4A Empties
0964: 0x00, // 0x4B Empties
0965: java.sql.Types.VARCHAR, // 0x4C SBCS
0966: java.sql.Types.VARCHAR, // 0x4D null SBCS
0967: java.sql.Types.VARCHAR, // 0x4E MBCS
0968: java.sql.Types.VARCHAR, // 0x4F null MBCS
0969: 0x00, // 0x50 Empties
0970: 0x00, // 0x51 Empties
0971: 0x00, // 0x52 Empties
0972: 0x00, // 0x53 Empties
0973: 0x00, // 0x54 Empties
0974: 0x00, // 0x55 Empties
0975: 0x00, // 0x56 Empties
0976: 0x00, // 0x57 Empties
0977: 0x00, // 0x58 Empties
0978: 0x00, // 0x59 Empties
0979: 0x00, // 0x5A Empties
0980: 0x00, // 0x5B Empties
0981: 0x00, // 0x5C Empties
0982: 0x00, // 0x5D Empties
0983: 0x00, // 0x5E Empties
0984: 0x00, // 0x5F Empties
0985: 0x00, // 0x60 Empties
0986: 0x00, // 0x61 Empties
0987: 0x00, // 0x62 Empties
0988: 0x00, // 0x63 Empties
0989: 0x00, // 0x64 Empties
0990: 0x00, // 0x65 Empties
0991: 0x00, // 0x66 Empties
0992: 0x00, // 0x67 Empties
0993: 0x00, // 0x68 Empties
0994: 0x00, // 0x69 Empties
0995: 0x00, // 0x6A Empties
0996: 0x00, // 0x6B Empties
0997: 0x00, // 0x6C Empties
0998: 0x00, // 0x6D Empties
0999: 0x00, // 0x6E Empties
1000: 0x00, // 0x6F Empties
1001: 0x00, // 0x70 Empties
1002: 0x00, // 0x71 Empties
1003: 0x00, // 0x72 Empties
1004: 0x00, // 0x73 Empties
1005: 0x00, // 0x74 Empties
1006: 0x00, // 0x75 Empties
1007: 0x00, // 0x76 Empties
1008: 0x00, // 0x77 Empties
1009: 0x00, // 0x78 Empties
1010: 0x00, // 0x79 Empties
1011: 0x00, // 0x7A Empties
1012: 0x00, // 0x7B Empties
1013: 0x00, // 0x7C Empties
1014: 0x00, // 0x7D Empties
1015: 0x00, // 0x7E Empties
1016: 0x00, // 0x7F Empties
1017: 0x00, // 0x80 Empties
1018: 0x00, // 0x81 Empties
1019: 0x00, // 0x82 Empties
1020: 0x00, // 0x83 Empties
1021: 0x00, // 0x84 Empties
1022: 0x00, // 0x85 Empties
1023: 0x00, // 0x86 Empties
1024: 0x00, // 0x87 Empties
1025: 0x00, // 0x88 Empties
1026: 0x00, // 0x89 Empties
1027: 0x00, // 0x8A Empties
1028: 0x00, // 0x8B Empties
1029: 0x00, // 0x8C Empties
1030: 0x00, // 0x8D Empties
1031: 0x00, // 0x8E Empties
1032: 0x00, // 0x8F Empties
1033: 0x00, // 0x90 Empties
1034: 0x00, // 0x91 Empties
1035: 0x00, // 0x92 Empties
1036: 0x00, // 0x93 Empties
1037: 0x00, // 0x94 Empties
1038: 0x00, // 0x95 Empties
1039: 0x00, // 0x96 Empties
1040: 0x00, // 0x97 Empties
1041: 0x00, // 0x98 Empties
1042: 0x00, // 0x99 Empties
1043: 0x00, // 0x9A Empties
1044: 0x00, // 0x9B Empties
1045: 0x00, // 0x9C Empties
1046: 0x00, // 0x9D Empties
1047: 0x00, // 0x9E Empties
1048: 0x00, // 0x9F Empties
1049: 0x00, // 0xA0 Empties
1050: 0x00, // 0xA1 Empties
1051: 0x00, // 0xA2 Empties
1052: 0x00, // 0xA3 Empties
1053: 0x00, // 0xA4 Empties
1054: 0x00, // 0xA5 Empties
1055: 0x00, // 0xA6 Empties
1056: 0x00, // 0xA7 Empties
1057: 0x00, // 0xA8 Empties
1058: 0x00, // 0xA9 Empties
1059: 0x00, // 0xAA Empties
1060: 0x00, // 0xAB Empties
1061: 0x00, // 0xAC Empties
1062: 0x00, // 0xAD Empties
1063: 0x00, // 0xAE Empties
1064: 0x00, // 0xAF Empties
1065: 0x00, // 0xB0 Empties
1066: 0x00, // 0xB1 Empties
1067: 0x00, // 0xB2 Empties
1068: 0x00, // 0xB3 Empties
1069: 0x00, // 0xB4 Empties
1070: 0x00, // 0xB5 Empties
1071: 0x00, // 0xB6 Empties
1072: 0x00, // 0xB7 Empties
1073: 0x00, // 0xB8 Empties
1074: 0x00, // 0xB9 Empties
1075: 0x00, // 0xBA Empties
1076: 0x00, // 0xBB Empties
1077: 0x00, // 0xBC Empties
1078: 0x00, // 0xBD Empties
1079: 0x00, // 0xBE Empties
1080: 0x00, // 0xBF Empties
1081: 0x00, // 0xC0 Empties
1082: 0x00, // 0xC1 Empties
1083: 0x00, // 0xC2 Empties
1084: 0x00, // 0xC3 Empties
1085: 0x00, // 0xC4 Empties
1086: 0x00, // 0xC5 Empties
1087: 0x00, // 0xC6 Empties
1088: 0x00, // 0xC7 Empties
1089: java.sql.Types.BLOB, // 0xC8 Large object bytes
1090: java.sql.Types.BLOB, // 0xC9 null Large object bytes
1091: java.sql.Types.CLOB, // 0xCA Large object char SBCS
1092: java.sql.Types.CLOB, // 0xCB null Large object char SBCS
1093: 0x00, 0x00, java.sql.Types.CLOB, // 0xCE Large object char MBCS
1094: java.sql.Types.CLOB, // 0xCF null Large object char MBCS
1095: };
1096:
1097: private NetAgent netAgent_;
1098: private String typdefnam_;
1099:
1100: private int ccsidSbc_;
1101: private boolean ccsidSbcSet_;
1102: private String ccsidSbcEncoding_;
1103:
1104: private int ccsidDbc_;
1105: private boolean ccsidDbcSet_;
1106: private String ccsidDbcEncoding_;
1107:
1108: private int ccsidMbc_;
1109: private boolean ccsidMbcSet_;
1110: private String ccsidMbcEncoding_;
1111:
1112: protected int environment_;
1113: private boolean mddOverride_ = false;
1114: private FdocaSimpleDataArray overrideTable_[] = new FdocaSimpleDataArray[OVERRIDE_TABLE_SIZE];
1115:
1116: //---------------------constructors/finalizer---------------------------------
1117:
1118: Typdef(NetAgent netAgent) throws DisconnectException {
1119: this .initialize(netAgent, 0, false, 0, false, 0, false, null);
1120: }
1121:
1122: Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam)
1123: throws DisconnectException {
1124: this .initialize(netAgent, ccsidSbc, true, 0, false, 0, false,
1125: typdefnam);
1126: }
1127:
1128: public Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam,
1129: int ccsidDbc, int ccsidMbc) throws DisconnectException {
1130: this .initialize(netAgent, ccsidSbc, true, ccsidMbc, true,
1131: ccsidDbc, true, typdefnam);
1132: }
1133:
1134: private void initialize(NetAgent netAgent, int ccsidSbc,
1135: boolean ccsidSbcSet, int ccsidMbc, boolean ccsidMbcSet,
1136: int ccsidDbc, boolean ccsidDbcSet, String typdefnam)
1137: throws DisconnectException {
1138: netAgent_ = netAgent;
1139: ccsidSbc_ = ccsidSbc;
1140: ccsidSbcSet_ = ccsidSbcSet;
1141: ccsidSbcEncoding_ = null;
1142: ccsidMbc_ = ccsidMbc;
1143: ccsidMbcSet_ = ccsidMbcSet;
1144: ccsidMbcEncoding_ = null;
1145: ccsidDbc_ = ccsidDbc;
1146: ccsidDbcSet_ = ccsidDbcSet;
1147: ccsidDbcEncoding_ = null;
1148: setTypdefnam(typdefnam);
1149: }
1150:
1151: //-------------------------private and package friendly methods---------------
1152:
1153: String getTypdefnam() {
1154: return typdefnam_;
1155: }
1156:
1157: void setTypdefnam(String typdefnam) throws DisconnectException {
1158: typdefnam_ = typdefnam;
1159: if (typdefnam_ == null) {
1160: return;
1161: }
1162:
1163: }
1164:
1165: int getCcsidSbc() {
1166: return ccsidSbc_;
1167: }
1168:
1169: void setCcsidSbc(int ccsid) {
1170: ccsidSbc_ = ccsid;
1171: ccsidSbcSet_ = true;
1172: ccsidSbcEncoding_ = null;
1173: }
1174:
1175: void clearCcsidSbc() {
1176: ccsidSbc_ = 0;
1177: ccsidSbcSet_ = false;
1178: ccsidSbcEncoding_ = null;
1179: }
1180:
1181: boolean isCcsidSbcSet() {
1182: return ccsidSbcSet_;
1183: }
1184:
1185: // analyze exception handling some more here
1186: String getCcsidSbcEncoding() throws DisconnectException {
1187: if (ccsidSbcEncoding_ == null) {
1188: ccsidSbcEncoding_ = UTF8ENCODING;
1189: }
1190: return ccsidSbcEncoding_;
1191: }
1192:
1193: int getCcsidDbc() {
1194: return ccsidDbc_;
1195: }
1196:
1197: void setCcsidDbc(int ccsid) {
1198: ccsidDbc_ = ccsid;
1199: ccsidDbcSet_ = true;
1200: ccsidDbcEncoding_ = null;
1201: }
1202:
1203: void clearCcsidDbc() {
1204: ccsidDbc_ = 0;
1205: ccsidDbcSet_ = false;
1206: ccsidDbcEncoding_ = null;
1207: }
1208:
1209: boolean isCcsidDbcSet() {
1210: return ccsidDbcSet_;
1211: }
1212:
1213: // analyze exception handling some more here
1214: String getCcsidDbcEncoding() throws DisconnectException {
1215: if (ccsidDbcEncoding_ == null) {
1216: ccsidDbcEncoding_ = UTF8ENCODING;
1217: }
1218: return ccsidDbcEncoding_;
1219: }
1220:
1221: int getCcsidMbc() {
1222: return ccsidMbc_;
1223: }
1224:
1225: void setCcsidMbc(int ccsid) {
1226: ccsidMbc_ = ccsid;
1227: ccsidMbcSet_ = true;
1228: ccsidMbcEncoding_ = null;
1229: }
1230:
1231: void clearCcsidMbc() {
1232: ccsidMbc_ = 0;
1233: ccsidMbcSet_ = false;
1234: ccsidMbcEncoding_ = null;
1235: }
1236:
1237: boolean isCcsidMbcSet() {
1238: return ccsidMbcSet_;
1239: }
1240:
1241: // analyze exception handling some more here
1242: String getCcsidMbcEncoding() throws DisconnectException {
1243: if (ccsidMbcEncoding_ == null) {
1244: ccsidMbcEncoding_ = UTF8ENCODING;
1245: }
1246: return ccsidMbcEncoding_;
1247: }
1248:
1249: int getByteOrder() {
1250: return SignedBinary.BIG_ENDIAN;
1251: }
1252:
1253: public Object clone() {
1254: try {
1255: return super .clone();
1256: } catch (java.lang.CloneNotSupportedException e) {
1257: return null; // this shouldn't happen since we implement the cloneable interface
1258: }
1259: }
1260:
1261: // Populates netCursor descriptors, rename this populateCursorDescriptors()
1262: void updateColumn(NetCursor netCursor, int columnIndex,
1263: int protocolLid, int protocolLength)
1264: throws DisconnectException {
1265: FdocaSimpleDataArray sda = environmentTables_[protocolLid];
1266:
1267: if ((mddOverride_) && (overrideTable_[protocolLid] != null)) {
1268: sda = overrideTable_[protocolLid];
1269: }
1270:
1271: if (sda == null) {
1272: netAgent_
1273: .accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(
1274: netAgent_, new ClientMessageId(
1275: SQLState.NET_INVALID_FDOCA_ID)));
1276: }
1277:
1278: // 2. Set Null indicator based on PROTOCOL Type.
1279: // Nullable SQL and PROTOCOL types are all odd numbers and the nullable
1280: // type is one number higher than the related non-nullable type.
1281: netCursor.nullable_[columnIndex] = ((sda.protocolType_ % 2) == 1);
1282:
1283: // 3. Update CCSID
1284: // The typdef object should store the java encoding,
1285: switch (sda.ccsid_) {
1286: case CCSIDSBC:
1287: netCursor.charsetName_[columnIndex] = getCcsidSbcEncoding();
1288: netCursor.ccsid_[columnIndex] = this .ccsidSbc_;
1289: break;
1290: case CCSIDMBC:
1291: if (isCcsidMbcSet() && (ccsidMbc_ != 0)) {
1292: netCursor.charsetName_[columnIndex] = getCcsidMbcEncoding();
1293: netCursor.ccsid_[columnIndex] = ccsidMbc_;
1294: } else {
1295: // if the server didn't return a mixed byte ccsid, set both the
1296: // encoding and the btc reference to null. see CCSIDDBC comment below.
1297: netCursor.charsetName_[columnIndex] = null;
1298: netCursor.ccsid_[columnIndex] = 0;
1299: }
1300: break;
1301: case CCSIDDBC:
1302: if (isCcsidDbcSet() && (ccsidDbc_ != 0)) {
1303: netCursor.charsetName_[columnIndex] = getCcsidDbcEncoding();
1304: netCursor.ccsid_[columnIndex] = this .ccsidDbc_;
1305: } else {
1306: // if the server didn't return a double byte ccsid, set both the
1307: // encoding and the btc reference to null. later an exception will
1308: // be thrown on the getXXX method. calling the getCcsidDbcEncoding method
1309: // will throw the exception here and this is not desirable.
1310: netCursor.charsetName_[columnIndex] = null;
1311: netCursor.ccsid_[columnIndex] = 0;
1312: }
1313: break;
1314:
1315: default: // This default case is used for mdd override ccsids.
1316: // In this case the sda.ccsid_ is the actual native ccsid,
1317: // otherwise the sda.ccsid_ is a placeholder:
1318: // CCSIDMBC, CCSIDDDBC, CCSIDSBC to indicate that
1319: // the actual ccsid is the connection's ccsid (in protocol lingo the connection's typdef ccsid).
1320: netCursor.charsetName_[columnIndex] = UTF8ENCODING;
1321: netCursor.ccsid_[columnIndex] = sda.ccsid_;
1322: break;
1323: }
1324:
1325: // 5. Set the length fdoca length.
1326: // For some types this may be a precision and a scale.
1327: // this includes FIXED DECIMAL (PROTOCOL type 0x0E, 0X0F),
1328: // retain the high order placeholder for lobs)
1329: // this includes LARGE OBJECT BYTES (PROTOCOL type 0xC8, 0xC9)
1330: // LARGE OBJECT CHAR SBCS (PROTOCOL type 0xCA, 0xCB)
1331: // LARGE OBJECT CHAR DBCS (PROTOCOL type 0xCC, 0xCD)
1332: // LARGE OBJECT CHAR MIXED (PROTOCOL type 0xCE, 0xCF)
1333: // also set the hasLobs_ flag to true
1334: if ((sda.protocolType_ >= 0xC8) && (sda.protocolType_ <= 0xCF)) {
1335: // retain placeholder information
1336: // right now just set the length...
1337: // probably need to accomodate for the high order placeholder bit
1338: netCursor.fdocaLength_[columnIndex] = protocolLength;
1339: netCursor.hasLobs_ = true;
1340: } else {
1341: netCursor.fdocaLength_[columnIndex] = protocolLength;
1342: }
1343:
1344: // 6. Set jdbc type.
1345: netCursor.jdbcTypes_[columnIndex] = protocolToJdbcTypes_[sda.protocolType_];
1346:
1347: // 7. Get the number of bytes to read for variable length data.
1348: netCursor.typeToUseForComputingDataLength_[columnIndex] = sda.typeToUseForComputingDataLength_;
1349:
1350: // 8. Update the maximumRowSize
1351: // Count : column null indicator +
1352: // column length +
1353: // posibly a 2-byte length for varchar columns
1354: switch (netCursor.typeToUseForComputingDataLength_[columnIndex]) {
1355: case DECIMALLENGTH:
1356: netCursor.maximumRowSize_ += 1 + 16;
1357: break;
1358: case LOBLENGTH:
1359: netCursor.maximumRowSize_ += 1 + (netCursor.fdocaLength_[columnIndex] & 0x7fff);
1360: break;
1361: default:
1362: netCursor.maximumRowSize_ += 1 + netCursor.fdocaLength_[columnIndex] + 2; // 2 is the length indicator for varchar
1363: break;
1364: }
1365:
1366: // 9. Get the character size.
1367: if (sda.characterSize_ == 2) {
1368: netCursor.isGraphic_[columnIndex] = true;
1369: }
1370:
1371: }
1372:
1373: // Called before the code parses a descriptor
1374: void clearMddOverrides() {
1375: if (mddOverride_ == false) {
1376: return;
1377: }
1378:
1379: mddOverride_ = false;
1380: for (int i = 0; i < OVERRIDE_TABLE_SIZE; i++) {
1381: overrideTable_[i] = null;
1382: }
1383: }
1384:
1385: // Called after the code parses a descriptor
1386: void setMddOverride(int protocolType, int fdocaTripletLid,
1387: int fdocaFieldType, int ccsid, int characterSize, int mode,
1388: int length) {
1389: mddOverride_ = true;
1390:
1391: if (overrideTable_[fdocaTripletLid] == null) {
1392: overrideTable_[fdocaTripletLid] = new FdocaSimpleDataArray(
1393: protocolType,
1394: fdocaFieldType,
1395: fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f],
1396: ccsid,
1397: characterSize,
1398: mode,
1399: length,
1400: mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType));
1401: } else {
1402: overrideTable_[fdocaTripletLid]
1403: .update(
1404: protocolType,
1405: fdocaFieldType,
1406: fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f],
1407: ccsid,
1408: characterSize,
1409: mode,
1410: length,
1411: mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType));
1412: }
1413: }
1414:
1415: private int mapFdocaTypeToTypeToUseForComputingDataLength(
1416: int fdocaFieldType) {
1417: switch (fdocaFieldType & 0x7f) { // &0x7f masks out the null indicator
1418: case FdocaConstants.FDOCA_TYPE_VARCHAR:
1419: case FdocaConstants.FDOCA_TYPE_VARBYTES:
1420: return Typdef.TWOBYTELENGTH;
1421: case FdocaConstants.FDOCA_TYPE_DECIMAL:
1422: case FdocaConstants.FDOCA_TYPE_NUMERIC_CHAR:
1423: return Typdef.DECIMALLENGTH;
1424: case FdocaConstants.FDOCA_TYPE_LOBBYTES:
1425: case FdocaConstants.FDOCA_TYPE_LOBCHAR:
1426: return Typdef.LOBLENGTH;
1427: case FdocaConstants.FDOCA_TYPE_PSCLBYTE:
1428: case FdocaConstants.FDOCA_TYPE_PSCLCHAR:
1429: return Typdef.ONEBYTELENGTH;
1430: default:
1431: return 0;
1432: }
1433: }
1434: }
|