KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.client.net.FdocaSimpleDataArray
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 class FdocaSimpleDataArray {
25     //---------------------navigational members-----------------------------------
26

27     //-----------------------------state------------------------------------------
28

29     // store the protocol type. this is needed to know
30
// which protocol type the mdd override is for.
31
int protocolType_;
32
33     // the FD:OCA field type indicator shows exactly how the data is represented
34
// in the environment. see the FD:OCA reference for a detailed explanation of
35
// these types.
36
int fdocaFieldType_;
37
38     // this is the representation used by the DNC converters. this is like the
39
// FD:OCA field type but the dnc converters don't use FD:OCA types as input.
40
int representation_;
41
42     // the ccsid identifies the encoding of the character data. converting the
43
// ccsid into binary form generates the four byte representation. The
44
// FD:OCA rules state that if the high order 16 bits of the CCSID field
45
// are zero, then the low order 16 bits are to be interpreted as a CCSID
46
int ccsid_;
47
48     // indicates the number of bytes each character takes in storage.
49
// 1 is used for character, date, time, timestamp, and numeric character fields.
50
// it must be 0 for all other types.
51
int characterSize_;
52
53     // this is used to specify mode of interpretation of FD:OCA
54
// architecture for all variable length data types (including null
55
// terminated), that as the SBCS variable character type. The
56
// low order bit of this byte is used to control interpretation
57
// of Length Fields in SDAs for variable length types. A '0' in that
58
// bit indicates that non-zero length field values indicate the space
59
// reserved for data and that all the space is transmitted
60
// whether or not it contains valid data. In the case of variable
61
// length types, the first two bytes of the data itself determine
62
// the valid data length. A '1' in this bit shows that non-zero length
63
// field values indicate the maximum value of the length fields
64
// that the data will contain. Only enough space to contain each
65
// data value is transmitted for each value.
66
int mode_;
67
68     // this represents the maximum valid value. when and if a group
69
// data array (GDA) triplet overrides it, the value can be reduced.
70
// For character fields with only DBCS characters, this is the length in
71
// characters (bytes/2). For all other cases, the length is in bytes.
72
// It does not include the length of the length field (variable length
73
// types) or null indicator (nullable types).
74
//
75
int fieldLength_;
76
77     // this is a group of types which indicates how the data length are computed.
78
int typeToUseForComputingDataLength_;
79
80     //---------------------constructors/finalizer---------------------------------
81

82     FdocaSimpleDataArray(int protocolType,
83                          int fdocaFieldType,
84                          int representation,
85                          int ccsid,
86                          int characterSize,
87                          int mode,
88                          int fieldLength,
89                          int typeToUseForComputingDataLength) {
90         protocolType_ = protocolType;
91         fdocaFieldType_ = fdocaFieldType;
92         representation_ = representation;
93         ccsid_ = ccsid;
94         characterSize_ = characterSize;
95         mode_ = mode;
96         fieldLength_ = fieldLength;
97         typeToUseForComputingDataLength_ = typeToUseForComputingDataLength;
98     }
99
100     public void update(int protocolType,
101                        int fdocaFieldType,
102                        int representation,
103                        int ccsid,
104                        int characterSize,
105                        int mode,
106                        int fieldLength,
107                        int typeToUseForComputingDataLength) {
108         protocolType_ = protocolType;
109         fdocaFieldType_ = fdocaFieldType;
110         representation_ = representation;
111         ccsid_ = ccsid;
112         characterSize_ = characterSize;
113         mode_ = mode;
114         fieldLength_ = fieldLength;
115         typeToUseForComputingDataLength_ = typeToUseForComputingDataLength;
116     }
117
118 }
119
Popular Tags