001: /*
002:
003: Derby - Class org.apache.derby.client.net.FdocaSimpleDataArray
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.client.net;
023:
024: class FdocaSimpleDataArray {
025: //---------------------navigational members-----------------------------------
026:
027: //-----------------------------state------------------------------------------
028:
029: // store the protocol type. this is needed to know
030: // which protocol type the mdd override is for.
031: int protocolType_;
032:
033: // the FD:OCA field type indicator shows exactly how the data is represented
034: // in the environment. see the FD:OCA reference for a detailed explanation of
035: // these types.
036: int fdocaFieldType_;
037:
038: // this is the representation used by the DNC converters. this is like the
039: // FD:OCA field type but the dnc converters don't use FD:OCA types as input.
040: int representation_;
041:
042: // the ccsid identifies the encoding of the character data. converting the
043: // ccsid into binary form generates the four byte representation. The
044: // FD:OCA rules state that if the high order 16 bits of the CCSID field
045: // are zero, then the low order 16 bits are to be interpreted as a CCSID
046: int ccsid_;
047:
048: // indicates the number of bytes each character takes in storage.
049: // 1 is used for character, date, time, timestamp, and numeric character fields.
050: // it must be 0 for all other types.
051: int characterSize_;
052:
053: // this is used to specify mode of interpretation of FD:OCA
054: // architecture for all variable length data types (including null
055: // terminated), that as the SBCS variable character type. The
056: // low order bit of this byte is used to control interpretation
057: // of Length Fields in SDAs for variable length types. A '0' in that
058: // bit indicates that non-zero length field values indicate the space
059: // reserved for data and that all the space is transmitted
060: // whether or not it contains valid data. In the case of variable
061: // length types, the first two bytes of the data itself determine
062: // the valid data length. A '1' in this bit shows that non-zero length
063: // field values indicate the maximum value of the length fields
064: // that the data will contain. Only enough space to contain each
065: // data value is transmitted for each value.
066: int mode_;
067:
068: // this represents the maximum valid value. when and if a group
069: // data array (GDA) triplet overrides it, the value can be reduced.
070: // For character fields with only DBCS characters, this is the length in
071: // characters (bytes/2). For all other cases, the length is in bytes.
072: // It does not include the length of the length field (variable length
073: // types) or null indicator (nullable types).
074: //
075: int fieldLength_;
076:
077: // this is a group of types which indicates how the data length are computed.
078: int typeToUseForComputingDataLength_;
079:
080: //---------------------constructors/finalizer---------------------------------
081:
082: FdocaSimpleDataArray(int protocolType, int fdocaFieldType,
083: int representation, int ccsid, int characterSize, int mode,
084: int fieldLength, int typeToUseForComputingDataLength) {
085: protocolType_ = protocolType;
086: fdocaFieldType_ = fdocaFieldType;
087: representation_ = representation;
088: ccsid_ = ccsid;
089: characterSize_ = characterSize;
090: mode_ = mode;
091: fieldLength_ = fieldLength;
092: typeToUseForComputingDataLength_ = typeToUseForComputingDataLength;
093: }
094:
095: public void update(int protocolType, int fdocaFieldType,
096: int representation, int ccsid, int characterSize, int mode,
097: int fieldLength, int typeToUseForComputingDataLength) {
098: protocolType_ = protocolType;
099: fdocaFieldType_ = fdocaFieldType;
100: representation_ = representation;
101: ccsid_ = ccsid;
102: characterSize_ = characterSize;
103: mode_ = mode;
104: fieldLength_ = fieldLength;
105: typeToUseForComputingDataLength_ = typeToUseForComputingDataLength;
106: }
107:
108: }
|