Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaConstants.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaConstants.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaConstants.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaConstants.java Sun May 1 23:25:59 2005 @@ -19,188 +19,187 @@ */ package org.apache.derby.client.net; -class FdocaConstants -{ +class FdocaConstants { // PROTOCOL FD:OCA constants. - static final int FDOCA_TYPE_FIXEDBYTES = 0x01; - static final int FDOCA_TYPE_NFIXEDBYTES = 0x81; - static final int FDOCA_TYPE_VARBYTES = 0x02; - static final int FDOCA_TYPE_NVARBYTES = 0x82; - static final int FDOCA_TYPE_NTBYTES = 0x03; - static final int FDOCA_TYPE_NNTBYTES = 0x83; - static final int FDOCA_TYPE_PSCLBYTE = 0x07; - static final int FDOCA_TYPE_NPSCLBYTE = 0x87; - static final int FDOCA_TYPE_FIXEDCHAR = 0x10; - static final int FDOCA_TYPE_NFIXEDCHAR = 0x90; - static final int FDOCA_TYPE_VARCHAR = 0x11; - static final int FDOCA_TYPE_NVARCHAR = 0x91; - static final int FDOCA_TYPE_NTCHAR = 0x14; - static final int FDOCA_TYPE_NNTCHAR = 0x94; - static final int FDOCA_TYPE_PSCLCHAR = 0x19; - static final int FDOCA_TYPE_NPSCLCHAR = 0x99; - static final int FDOCA_TYPE_INTEGER_BE = 0x23; - static final int FDOCA_TYPE_NINTEGER_BE = 0xA3; - static final int FDOCA_TYPE_INTEGER_LE = 0x24; - static final int FDOCA_TYPE_NINTEGER_LE = 0xA4; - static final int FDOCA_TYPE_DECIMAL = 0x30; - static final int FDOCA_TYPE_NDECIMAL = 0xB0; - static final int FDOCA_TYPE_NUMERIC_CHAR = 0x32; - static final int FDOCA_TYPE_NNUMERIC_CHAR = 0xB2; - static final int FDOCA_TYPE_FLOAT_X86 = 0x47; - static final int FDOCA_TYPE_NFLOAT_X86 = 0xC7; - static final int FDOCA_TYPE_FLOAT_IEEE = 0x48; - static final int FDOCA_TYPE_NFLOAT_IEEE = 0xC8; - static final int FDOCA_TYPE_LOBBYTES = 0x50; - static final int FDOCA_TYPE_NLOBBYTES = 0xD0; - static final int FDOCA_TYPE_LOBCHAR = 0x51; - static final int FDOCA_TYPE_NLOBCHAR = 0xD1; - - // PROTOCOL Type constants. - static final int PROTOCOL_TYPE_INTEGER = 0x02; - static final int PROTOCOL_TYPE_NINTEGER = 0x03; - static final int PROTOCOL_TYPE_SMALL = 0x04; - static final int PROTOCOL_TYPE_NSMALL = 0x05; - static final int PROTOCOL_TYPE_1BYTE_INT = 0x06; - static final int PROTOCOL_TYPE_N1BYTE_INT = 0x07; - static final int PROTOCOL_TYPE_FLOAT16 = 0x08; - static final int PROTOCOL_TYPE_NFLOAT16 = 0x09; - static final int PROTOCOL_TYPE_FLOAT8 = 0x0A; - static final int PROTOCOL_TYPE_NFLOAT8 = 0x0B; - static final int PROTOCOL_TYPE_FLOAT4 = 0x0C; - static final int PROTOCOL_TYPE_NFLOAT4 = 0x0D; - static final int PROTOCOL_TYPE_DECIMAL = 0x0E; - static final int PROTOCOL_TYPE_NDECIMAL = 0x0F; - static final int PROTOCOL_TYPE_NUMERIC_CHAR = 0x12; - static final int PROTOCOL_TYPE_NNUMERIC_CHAR = 0x13; - static final int PROTOCOL_TYPE_RSET_LOC = 0x14; - static final int PROTOCOL_TYPE_NRSET_LOC = 0x15; - static final int PROTOCOL_TYPE_INTEGER8 = 0x16; - static final int PROTOCOL_TYPE_NINTEGER8 = 0x17; - static final int PROTOCOL_TYPE_LOBLOC = 0x18; - static final int PROTOCOL_TYPE_NLOBLOC = 0x19; - static final int PROTOCOL_TYPE_CLOBLOC = 0x1A; - static final int PROTOCOL_TYPE_NCLOBLOC = 0x1B; - static final int PROTOCOL_TYPE_DBCSCLOBLOC = 0x1C; - static final int PROTOCOL_TYPE_NDBCSCLOBLOC = 0x1D; - static final int PROTOCOL_TYPE_DATE = 0x20; - static final int PROTOCOL_TYPE_NDATE = 0x21; - static final int PROTOCOL_TYPE_TIME = 0x22; - static final int PROTOCOL_TYPE_NTIME = 0x23; - static final int PROTOCOL_TYPE_TIMESTAMP = 0x24; - static final int PROTOCOL_TYPE_NTIMESTAMP = 0x25; - static final int PROTOCOL_TYPE_FIXBYTE = 0x26; - static final int PROTOCOL_TYPE_NFIXBYTE = 0x27; - static final int PROTOCOL_TYPE_VARBYTE = 0x28; - static final int PROTOCOL_TYPE_NVARBYTE = 0x29; - static final int PROTOCOL_TYPE_LONGVARBYTE = 0x2A; - static final int PROTOCOL_TYPE_NLONGVARBYTE = 0x2B; - static final int PROTOCOL_TYPE_NTERMBYTE = 0x2C; - static final int PROTOCOL_TYPE_NNTERMBYTE = 0x2D; - static final int PROTOCOL_TYPE_CSTR = 0x2E; - static final int PROTOCOL_TYPE_NCSTR = 0x2F; - static final int PROTOCOL_TYPE_CHAR = 0x30; - static final int PROTOCOL_TYPE_NCHAR = 0x31; - static final int PROTOCOL_TYPE_VARCHAR = 0x32; - static final int PROTOCOL_TYPE_NVARCHAR = 0x33; - static final int PROTOCOL_TYPE_LONG = 0x34; - static final int PROTOCOL_TYPE_NLONG = 0x35; - static final int PROTOCOL_TYPE_MIX = 0x3C; - static final int PROTOCOL_TYPE_NMIX = 0x3D; - static final int PROTOCOL_TYPE_VARMIX = 0x3E; - static final int PROTOCOL_TYPE_NVARMIX = 0x3F; - static final int PROTOCOL_TYPE_LONGMIX = 0x40; - static final int PROTOCOL_TYPE_NLONGMIX = 0x41; - static final int PROTOCOL_TYPE_CSTRMIX = 0x42; - static final int PROTOCOL_TYPE_NCSTRMIX = 0x43; - static final int PROTOCOL_TYPE_PSCLBYTE = 0x44; - static final int PROTOCOL_TYPE_NPSCLBYTE = 0x45; - - // --- Override LIDs 0x50 - 0xAF - static final int FIRST_OVERRIDE_LID = 0x50; - static final int LAST_OVERRIDE_LID = 0xAF; - - static final int PROTOCOL_TYPE_LOBBYTES = 0xC8; - static final int PROTOCOL_TYPE_NLOBBYTES = 0xC9; - static final int PROTOCOL_TYPE_LOBCSBCS = 0xCA; - static final int PROTOCOL_TYPE_NLOBCSBCS = 0xCB; - static final int PROTOCOL_TYPE_LOBCDBCS = 0xCC; - static final int PROTOCOL_TYPE_NLOBCDBCS = 0xCD; - static final int PROTOCOL_TYPE_LOBCMIXED = 0xCE; - static final int PROTOCOL_TYPE_NLOBCMIXED = 0xCF; - - static final int CPT_TRIPLET_TYPE = 0x7F; // CPT triplet type - static final int MDD_TRIPLET_TYPE = 0x78; // MDD triplet type - static final int NGDA_TRIPLET_TYPE = 0x76; // N-GDA triplet type - static final int RLO_TRIPLET_TYPE = 0x71; // RLO triplet type - static final int SDA_TRIPLET_TYPE = 0x70; // SDA triplet type - - static final int SQLDTARD_LID = 0xF0; - static final int SQLCADTA_LID = 0xE0; - static final int SQLDTAGRP_LID = 0xD0; // SQLDTAGRP LID - static final int NULL_LID = 0x00; - - static final int INDICATOR_NULLABLE = 0x00; - static final int NULL_DATA = 0xFF; - - static final int MAX_VARS_IN_NGDA = 84; // Number of SQLVARs in full SQLDTAGRP - // N-GDA or CPT - static final int MDD_TRIPLET_SIZE = 7; // Size of MDD triplet - static final int SQLDTARD_RLO_SIZE = 6; // size of SQLDTARD minus MDD - static final int SQLCADTA_RLO_SIZE = 9; // size of SQLCDTA minus MDD - static final int SDA_TRIPLET_SIZE = 12; // Size of SDA triplet - static final int SQLDTAGRP_SIZE = 3; // Size of SQLDTAGRP descriptor - static final int CPT_SIZE = 3; // Size of CPT descriptor - static final int SQLDTAGRP_COL_DSC_SIZE = 3; // Env. LID & len. bytes - static final int MDD_REST_SIZE = 5; // Size of the MDD group minus length and type - - static final int MDD_SDA_TRIPLET_SIZE = 19; - static final int MDD_SDA_PROTOCOLTYPE_OFFSET = 6; - static final int MDD_SDA_FDOCALID_OFFSET = 9; - static final int MDD_SDA_FDOCATYPE_OFFSET = 10; - static final int MDD_SDA_CCSID_OFFSET = 11; - static final int MDD_SDA_LENGTH_OFFSET = 17; - - static final byte[] defaultMddSdaBytes = { - (byte)0x07, (byte)0x78, (byte)0x00, (byte)0x05, - (byte)0x01, (byte)0x01, (byte)0x00, // protocol type - (byte)0x0C, (byte)0x70, (byte)0x00, // fdoca triplet lid - (byte)0x00, // fdoca field type - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, // ccsid - (byte)0x01, (byte)0x01, - (byte)0x7F, (byte)0xFF // length - }; - - static final byte[] MDD_SQLDTAGRP_TOSEND = { - (byte)0x07, (byte)0x78, (byte)0x00, (byte)0x05, - (byte)0x02, (byte)0x01, (byte)0xD0 - }; - - static final byte[] MDD_SQLDTA_TOSEND = { - (byte)0x07, (byte)0x78, (byte)0x00, (byte)0x05, - (byte)0x03, (byte)0x01, (byte)0xE4 - }; - - // Hard-coded SQLDTA RLO - static final byte[] SQLDTA_RLO_TOSEND = { - (byte)0x06, (byte)0x71, (byte)0xE4, - (byte)0xD0, (byte)0x00, (byte)0x01 - }; - - // Hard-coded SQLCADTA RLO - static final byte[] SQLCADTA_RLO_TOSEND = { - (byte)0x09, (byte)0x71, (byte)0xE0, - (byte)0x54, (byte)0x00, (byte)0x01, - (byte)0xD0, (byte)0x00, (byte)0x01 - }; - - // Hard-coded SQLDTARD RLO - static final byte[] SQLDTARD_RLO_TOSEND = { - (byte)0X06, (byte)0X71, (byte)0xF0, - (byte)0xE0, (byte)0x00, (byte)0x00 - }; + static final int FDOCA_TYPE_FIXEDBYTES = 0x01; + static final int FDOCA_TYPE_NFIXEDBYTES = 0x81; + static final int FDOCA_TYPE_VARBYTES = 0x02; + static final int FDOCA_TYPE_NVARBYTES = 0x82; + static final int FDOCA_TYPE_NTBYTES = 0x03; + static final int FDOCA_TYPE_NNTBYTES = 0x83; + static final int FDOCA_TYPE_PSCLBYTE = 0x07; + static final int FDOCA_TYPE_NPSCLBYTE = 0x87; + static final int FDOCA_TYPE_FIXEDCHAR = 0x10; + static final int FDOCA_TYPE_NFIXEDCHAR = 0x90; + static final int FDOCA_TYPE_VARCHAR = 0x11; + static final int FDOCA_TYPE_NVARCHAR = 0x91; + static final int FDOCA_TYPE_NTCHAR = 0x14; + static final int FDOCA_TYPE_NNTCHAR = 0x94; + static final int FDOCA_TYPE_PSCLCHAR = 0x19; + static final int FDOCA_TYPE_NPSCLCHAR = 0x99; + static final int FDOCA_TYPE_INTEGER_BE = 0x23; + static final int FDOCA_TYPE_NINTEGER_BE = 0xA3; + static final int FDOCA_TYPE_INTEGER_LE = 0x24; + static final int FDOCA_TYPE_NINTEGER_LE = 0xA4; + static final int FDOCA_TYPE_DECIMAL = 0x30; + static final int FDOCA_TYPE_NDECIMAL = 0xB0; + static final int FDOCA_TYPE_NUMERIC_CHAR = 0x32; + static final int FDOCA_TYPE_NNUMERIC_CHAR = 0xB2; + static final int FDOCA_TYPE_FLOAT_X86 = 0x47; + static final int FDOCA_TYPE_NFLOAT_X86 = 0xC7; + static final int FDOCA_TYPE_FLOAT_IEEE = 0x48; + static final int FDOCA_TYPE_NFLOAT_IEEE = 0xC8; + static final int FDOCA_TYPE_LOBBYTES = 0x50; + static final int FDOCA_TYPE_NLOBBYTES = 0xD0; + static final int FDOCA_TYPE_LOBCHAR = 0x51; + static final int FDOCA_TYPE_NLOBCHAR = 0xD1; + + // PROTOCOL Type constants. + static final int PROTOCOL_TYPE_INTEGER = 0x02; + static final int PROTOCOL_TYPE_NINTEGER = 0x03; + static final int PROTOCOL_TYPE_SMALL = 0x04; + static final int PROTOCOL_TYPE_NSMALL = 0x05; + static final int PROTOCOL_TYPE_1BYTE_INT = 0x06; + static final int PROTOCOL_TYPE_N1BYTE_INT = 0x07; + static final int PROTOCOL_TYPE_FLOAT16 = 0x08; + static final int PROTOCOL_TYPE_NFLOAT16 = 0x09; + static final int PROTOCOL_TYPE_FLOAT8 = 0x0A; + static final int PROTOCOL_TYPE_NFLOAT8 = 0x0B; + static final int PROTOCOL_TYPE_FLOAT4 = 0x0C; + static final int PROTOCOL_TYPE_NFLOAT4 = 0x0D; + static final int PROTOCOL_TYPE_DECIMAL = 0x0E; + static final int PROTOCOL_TYPE_NDECIMAL = 0x0F; + static final int PROTOCOL_TYPE_NUMERIC_CHAR = 0x12; + static final int PROTOCOL_TYPE_NNUMERIC_CHAR = 0x13; + static final int PROTOCOL_TYPE_RSET_LOC = 0x14; + static final int PROTOCOL_TYPE_NRSET_LOC = 0x15; + static final int PROTOCOL_TYPE_INTEGER8 = 0x16; + static final int PROTOCOL_TYPE_NINTEGER8 = 0x17; + static final int PROTOCOL_TYPE_LOBLOC = 0x18; + static final int PROTOCOL_TYPE_NLOBLOC = 0x19; + static final int PROTOCOL_TYPE_CLOBLOC = 0x1A; + static final int PROTOCOL_TYPE_NCLOBLOC = 0x1B; + static final int PROTOCOL_TYPE_DBCSCLOBLOC = 0x1C; + static final int PROTOCOL_TYPE_NDBCSCLOBLOC = 0x1D; + static final int PROTOCOL_TYPE_DATE = 0x20; + static final int PROTOCOL_TYPE_NDATE = 0x21; + static final int PROTOCOL_TYPE_TIME = 0x22; + static final int PROTOCOL_TYPE_NTIME = 0x23; + static final int PROTOCOL_TYPE_TIMESTAMP = 0x24; + static final int PROTOCOL_TYPE_NTIMESTAMP = 0x25; + static final int PROTOCOL_TYPE_FIXBYTE = 0x26; + static final int PROTOCOL_TYPE_NFIXBYTE = 0x27; + static final int PROTOCOL_TYPE_VARBYTE = 0x28; + static final int PROTOCOL_TYPE_NVARBYTE = 0x29; + static final int PROTOCOL_TYPE_LONGVARBYTE = 0x2A; + static final int PROTOCOL_TYPE_NLONGVARBYTE = 0x2B; + static final int PROTOCOL_TYPE_NTERMBYTE = 0x2C; + static final int PROTOCOL_TYPE_NNTERMBYTE = 0x2D; + static final int PROTOCOL_TYPE_CSTR = 0x2E; + static final int PROTOCOL_TYPE_NCSTR = 0x2F; + static final int PROTOCOL_TYPE_CHAR = 0x30; + static final int PROTOCOL_TYPE_NCHAR = 0x31; + static final int PROTOCOL_TYPE_VARCHAR = 0x32; + static final int PROTOCOL_TYPE_NVARCHAR = 0x33; + static final int PROTOCOL_TYPE_LONG = 0x34; + static final int PROTOCOL_TYPE_NLONG = 0x35; + static final int PROTOCOL_TYPE_MIX = 0x3C; + static final int PROTOCOL_TYPE_NMIX = 0x3D; + static final int PROTOCOL_TYPE_VARMIX = 0x3E; + static final int PROTOCOL_TYPE_NVARMIX = 0x3F; + static final int PROTOCOL_TYPE_LONGMIX = 0x40; + static final int PROTOCOL_TYPE_NLONGMIX = 0x41; + static final int PROTOCOL_TYPE_CSTRMIX = 0x42; + static final int PROTOCOL_TYPE_NCSTRMIX = 0x43; + static final int PROTOCOL_TYPE_PSCLBYTE = 0x44; + static final int PROTOCOL_TYPE_NPSCLBYTE = 0x45; + + // --- Override LIDs 0x50 - 0xAF + static final int FIRST_OVERRIDE_LID = 0x50; + static final int LAST_OVERRIDE_LID = 0xAF; + + static final int PROTOCOL_TYPE_LOBBYTES = 0xC8; + static final int PROTOCOL_TYPE_NLOBBYTES = 0xC9; + static final int PROTOCOL_TYPE_LOBCSBCS = 0xCA; + static final int PROTOCOL_TYPE_NLOBCSBCS = 0xCB; + static final int PROTOCOL_TYPE_LOBCDBCS = 0xCC; + static final int PROTOCOL_TYPE_NLOBCDBCS = 0xCD; + static final int PROTOCOL_TYPE_LOBCMIXED = 0xCE; + static final int PROTOCOL_TYPE_NLOBCMIXED = 0xCF; + + static final int CPT_TRIPLET_TYPE = 0x7F; // CPT triplet type + static final int MDD_TRIPLET_TYPE = 0x78; // MDD triplet type + static final int NGDA_TRIPLET_TYPE = 0x76; // N-GDA triplet type + static final int RLO_TRIPLET_TYPE = 0x71; // RLO triplet type + static final int SDA_TRIPLET_TYPE = 0x70; // SDA triplet type + + static final int SQLDTARD_LID = 0xF0; + static final int SQLCADTA_LID = 0xE0; + static final int SQLDTAGRP_LID = 0xD0; // SQLDTAGRP LID + static final int NULL_LID = 0x00; + + static final int INDICATOR_NULLABLE = 0x00; + static final int NULL_DATA = 0xFF; + + static final int MAX_VARS_IN_NGDA = 84; // Number of SQLVARs in full SQLDTAGRP + // N-GDA or CPT + static final int MDD_TRIPLET_SIZE = 7; // Size of MDD triplet + static final int SQLDTARD_RLO_SIZE = 6; // size of SQLDTARD minus MDD + static final int SQLCADTA_RLO_SIZE = 9; // size of SQLCDTA minus MDD + static final int SDA_TRIPLET_SIZE = 12; // Size of SDA triplet + static final int SQLDTAGRP_SIZE = 3; // Size of SQLDTAGRP descriptor + static final int CPT_SIZE = 3; // Size of CPT descriptor + static final int SQLDTAGRP_COL_DSC_SIZE = 3; // Env. LID & len. bytes + static final int MDD_REST_SIZE = 5; // Size of the MDD group minus length and type + + static final int MDD_SDA_TRIPLET_SIZE = 19; + static final int MDD_SDA_PROTOCOLTYPE_OFFSET = 6; + static final int MDD_SDA_FDOCALID_OFFSET = 9; + static final int MDD_SDA_FDOCATYPE_OFFSET = 10; + static final int MDD_SDA_CCSID_OFFSET = 11; + static final int MDD_SDA_LENGTH_OFFSET = 17; + + static final byte[] defaultMddSdaBytes = { + (byte) 0x07, (byte) 0x78, (byte) 0x00, (byte) 0x05, + (byte) 0x01, (byte) 0x01, (byte) 0x00, // protocol type + (byte) 0x0C, (byte) 0x70, (byte) 0x00, // fdoca triplet lid + (byte) 0x00, // fdoca field type + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // ccsid + (byte) 0x01, (byte) 0x01, + (byte) 0x7F, (byte) 0xFF // length + }; + + static final byte[] MDD_SQLDTAGRP_TOSEND = { + (byte) 0x07, (byte) 0x78, (byte) 0x00, (byte) 0x05, + (byte) 0x02, (byte) 0x01, (byte) 0xD0 + }; + + static final byte[] MDD_SQLDTA_TOSEND = { + (byte) 0x07, (byte) 0x78, (byte) 0x00, (byte) 0x05, + (byte) 0x03, (byte) 0x01, (byte) 0xE4 + }; + + // Hard-coded SQLDTA RLO + static final byte[] SQLDTA_RLO_TOSEND = { + (byte) 0x06, (byte) 0x71, (byte) 0xE4, + (byte) 0xD0, (byte) 0x00, (byte) 0x01 + }; + + // Hard-coded SQLCADTA RLO + static final byte[] SQLCADTA_RLO_TOSEND = { + (byte) 0x09, (byte) 0x71, (byte) 0xE0, + (byte) 0x54, (byte) 0x00, (byte) 0x01, + (byte) 0xD0, (byte) 0x00, (byte) 0x01 + }; + + // Hard-coded SQLDTARD RLO + static final byte[] SQLDTARD_RLO_TOSEND = { + (byte) 0X06, (byte) 0X71, (byte) 0xF0, + (byte) 0xE0, (byte) 0x00, (byte) 0x00 + }; - // following code added for parseSQLDTARD prototype + // following code added for parseSQLDTARD prototype static final int SQLDTARD_TRIPLET_TYPE_START = 0; static final int SQLDTARD_TRIPLET_TYPE_END = 1; static final int SQLDTARD_TRIPLET_TYPE_MDD = 2; @@ -210,14 +209,14 @@ static final int SQLDTARD_TRIPLET_TYPE_CPT = 6; static final boolean[][] SQLDTARD_TRIPLET_TYPES = { - // /*START*/, /*END*/, /*MDD*/, /*SDA*/, /*RLO*/, /*GDA*/, /*CPT*/ // next -> -/*START*/ { false , false , true , false , false , true , false }, -/* END */ { false , false , false , false , false , false , false }, -/* MDD */ { false , false , false , true , true , true , false }, // | -/* SDA */ { false , false , true , false , false , false , false }, // previous | -/* RLO */ { false , true , true , false , true , false , false }, // \ / -/* GDA */ { false , false , true , false , true , false , true }, -/* CPT */ { false , false , true , false , true , false , true }}; + // /*START*/, /*END*/, /*MDD*/, /*SDA*/, /*RLO*/, /*GDA*/, /*CPT*/ // next -> +/*START*/ {false, false, true, false, false, true, false}, +/* END */ {false, false, false, false, false, false, false}, +/* MDD */ {false, false, false, true, true, true, false}, // | +/* SDA */ {false, false, true, false, false, false, false}, // previous | +/* RLO */ {false, true, true, false, true, false, false}, // \ / +/* GDA */ {false, false, true, false, true, false, true}, +/* CPT */ {false, false, true, false, true, false, true}}; static final int SQLDTARD_TRIPLET_ID_START = 0; static final int SQLDTARD_TRIPLET_ID_END = 1; @@ -228,24 +227,24 @@ static final int SQLDTARD_TRIPLET_ID_F0 = 6; static final boolean[][] SQLDTARD_TRIPLET_IDS = { - // /*START*/, /*END*/, /*SDA*/, /*0*/, /*D0*/, /*E0*/, /*F4*/ // next -> -/*START*/ { false , false , false , true , true , false , false }, -/* END */ { false , false , false , false, false, false , false }, -/* SDA */ { false , false , false , true , false, false , false }, -/* 0 */ { false , false , true , true , true , true , true }, -/* D0 */ { false , false , false , true , false, true , false }, -/* E0 */ { false , false , false , true , false, false , true }, -/* F4 */ { false , true , false , false, false, false , false }}; + // /*START*/, /*END*/, /*SDA*/, /*0*/, /*D0*/, /*E0*/, /*F4*/ // next -> +/*START*/ {false, false, false, true, true, false, false}, +/* END */ {false, false, false, false, false, false, false}, +/* SDA */ {false, false, false, true, false, false, false}, +/* 0 */ {false, false, true, true, true, true, true}, +/* D0 */ {false, false, false, true, false, true, false}, +/* E0 */ {false, false, false, true, false, false, true}, +/* F4 */ {false, true, false, false, false, false, false}}; static final int RLO_GROUP_LID = 0; static final int RLO_ELEMENT_TAKEN = 1; static final int RLO_REP_FACTOR = 2; static final int[][] RLO_SQLCADTA = {// GROUP LID , ELEM TAKEN, REP_FACTOR - { 0x54 , 0 , 1}, - { 0xD0 , 0 , 1}}; + {0x54, 0, 1}, + {0xD0, 0, 1}}; static final int[][] RLO_SQLDTARD = {// GROUP LID , ELEM TAKEN, REP_FACTOR - { 0xE0 , 0 , 0}}; + {0xE0, 0, 0}}; }
Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaSimpleDataArray.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaSimpleDataArray.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaSimpleDataArray.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/FdocaSimpleDataArray.java Sun May 1 23:25:59 2005 @@ -20,102 +20,98 @@ package org.apache.derby.client.net; -class FdocaSimpleDataArray -{ - //---------------------navigational members----------------------------------- - - //-----------------------------state------------------------------------------ - - // store the protocol type. this is needed to know - // which protocol type the mdd override is for. - int protocolType_; - - // the FD:OCA field type indicator shows exactly how the data is represented - // in the environment. see the FD:OCA reference for a detailed explanation of - // these types. - int fdocaFieldType_; - - // this is the representation used by the DNC converters. this is like the - // FD:OCA field type but the dnc converters don't use FD:OCA types as input. - int representation_; - - // the ccsid identifies the encoding of the character data. converting the - // ccsid into binary form generates the four byte representation. The - // FD:OCA rules state that if the high order 16 bits of the CCSID field - // are zero, then the low order 16 bits are to be interpreted as a CCSID - int ccsid_; - - // indicates the number of bytes each character takes in storage. - // 1 is used for character, date, time, timestamp, and numeric character fields. - // it must be 0 for all other types. - int characterSize_; - - // this is used to specify mode of interpretation of FD:OCA - // architecture for all variable length data types (including null - // terminated), that as the SBCS variable character type. The - // low order bit of this byte is used to control interpretation - // of Length Fields in SDAs for variable length types. A '0' in that - // bit indicates that non-zero length field values indicate the space - // reserved for data and that all the space is transmitted - // whether or not it contains valid data. In the case of variable - // length types, the first two bytes of the data itself determine - // the valid data length. A '1' in this bit shows that non-zero length - // field values indicate the maximum value of the length fields - // that the data will contain. Only enough space to contain each - // data value is transmitted for each value. - int mode_; - - // this represents the maximum valid value. when and if a group - // data array (GDA) triplet overrides it, the value can be reduced. - // For character fields with only DBCS characters, this is the length in - // characters (bytes/2). For all other cases, the length is in bytes. - // It does not include the length of the length field (variable length - // types) or null indicator (nullable types). - // - int fieldLength_; - - // this is a group of types which indicates how the data length are computed. - int typeToUseForComputingDataLength_; - - //---------------------constructors/finalizer--------------------------------- - - FdocaSimpleDataArray (int protocolType, - int fdocaFieldType, - int representation, - int ccsid, - int characterSize, - int mode, - int fieldLength, - int typeToUseForComputingDataLength) - - { - protocolType_ = protocolType; - fdocaFieldType_ = fdocaFieldType; - representation_ = representation; - ccsid_ = ccsid; - characterSize_ = characterSize; - mode_ = mode; - fieldLength_ = fieldLength; - typeToUseForComputingDataLength_ = typeToUseForComputingDataLength; - } - - public void update (int protocolType, - int fdocaFieldType, - int representation, - int ccsid, - int characterSize, - int mode, - int fieldLength, - int typeToUseForComputingDataLength) - { - protocolType_ = protocolType; - fdocaFieldType_ = fdocaFieldType; - representation_ = representation; - ccsid_ = ccsid; - characterSize_ = characterSize; - mode_ = mode; - fieldLength_ = fieldLength; - typeToUseForComputingDataLength_ = typeToUseForComputingDataLength; - } +class FdocaSimpleDataArray { + //---------------------navigational members----------------------------------- + + //-----------------------------state------------------------------------------ + + // store the protocol type. this is needed to know + // which protocol type the mdd override is for. + int protocolType_; + + // the FD:OCA field type indicator shows exactly how the data is represented + // in the environment. see the FD:OCA reference for a detailed explanation of + // these types. + int fdocaFieldType_; + + // this is the representation used by the DNC converters. this is like the + // FD:OCA field type but the dnc converters don't use FD:OCA types as input. + int representation_; + + // the ccsid identifies the encoding of the character data. converting the + // ccsid into binary form generates the four byte representation. The + // FD:OCA rules state that if the high order 16 bits of the CCSID field + // are zero, then the low order 16 bits are to be interpreted as a CCSID + int ccsid_; + + // indicates the number of bytes each character takes in storage. + // 1 is used for character, date, time, timestamp, and numeric character fields. + // it must be 0 for all other types. + int characterSize_; + + // this is used to specify mode of interpretation of FD:OCA + // architecture for all variable length data types (including null + // terminated), that as the SBCS variable character type. The + // low order bit of this byte is used to control interpretation + // of Length Fields in SDAs for variable length types. A '0' in that + // bit indicates that non-zero length field values indicate the space + // reserved for data and that all the space is transmitted + // whether or not it contains valid data. In the case of variable + // length types, the first two bytes of the data itself determine + // the valid data length. A '1' in this bit shows that non-zero length + // field values indicate the maximum value of the length fields + // that the data will contain. Only enough space to contain each + // data value is transmitted for each value. + int mode_; + + // this represents the maximum valid value. when and if a group + // data array (GDA) triplet overrides it, the value can be reduced. + // For character fields with only DBCS characters, this is the length in + // characters (bytes/2). For all other cases, the length is in bytes. + // It does not include the length of the length field (variable length + // types) or null indicator (nullable types). + // + int fieldLength_; + + // this is a group of types which indicates how the data length are computed. + int typeToUseForComputingDataLength_; + + //---------------------constructors/finalizer--------------------------------- + + FdocaSimpleDataArray(int protocolType, + int fdocaFieldType, + int representation, + int ccsid, + int characterSize, + int mode, + int fieldLength, + int typeToUseForComputingDataLength) { + protocolType_ = protocolType; + fdocaFieldType_ = fdocaFieldType; + representation_ = representation; + ccsid_ = ccsid; + characterSize_ = characterSize; + mode_ = mode; + fieldLength_ = fieldLength; + typeToUseForComputingDataLength_ = typeToUseForComputingDataLength; + } + + public void update(int protocolType, + int fdocaFieldType, + int representation, + int ccsid, + int characterSize, + int mode, + int fieldLength, + int typeToUseForComputingDataLength) { + protocolType_ = protocolType; + fdocaFieldType_ = fdocaFieldType; + representation_ = representation; + ccsid_ = ccsid; + characterSize_ = characterSize; + mode_ = mode; + fieldLength_ = fieldLength; + typeToUseForComputingDataLength_ = typeToUseForComputingDataLength; + } } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java Sun May 1 23:25:59 2005 @@ -21,469 +21,450 @@ package org.apache.derby.client.net; import org.apache.derby.client.am.Agent; -import org.apache.derby.client.am.Utils; -import org.apache.derby.client.am.SqlException; import org.apache.derby.client.am.DisconnectException; +import org.apache.derby.client.am.SqlException; +import org.apache.derby.client.am.Utils; -public class NetAgent extends Agent -{ - //---------------------navigational members----------------------------------- - - // All these request objects point to the same physical request object. - public ConnectionRequestInterface connectionRequest_; - public NetConnectionRequest packageRequest_; - public StatementRequestInterface statementRequest_; - public ResultSetRequestInterface resultSetRequest_; - - // All these reply objects point to the same physical reply object. - public ConnectionReply connectionReply_; - public ConnectionReply packageReply_; - public StatementReply statementReply_; - public ResultSetReply resultSetReply_; - - //---------------------navigational cheat-links------------------------------- - // Cheat-links are for convenience only, and are not part of the conceptual model. - // Warning: - // Cheat-links should only be defined for invariant state data. - // That is, the state data is set by the constructor and never changes. - - // Alias for (NetConnection) super.connection - NetConnection netConnection_; - - // Alias for (Request) super.*Request, all in one - // In the case of the NET implementation, these all point to the same physical request object. - protected Request request_; - public NetConnectionRequest netConnectionRequest_; - public NetPackageRequest netPackageRequest_; - public NetStatementRequest netStatementRequest_; - public NetResultSetRequest netResultSetRequest_; - - // Alias for (Reply) super.*Reply, all in one. - // In the case of the NET implementation, these all point to the same physical reply object. - protected Reply reply_; - public NetConnectionReply netConnectionReply_; - public NetPackageReply netPackageReply_; - public NetStatementReply netStatementReply_; - public NetResultSetReply netResultSetReply_; - - //-----------------------------state------------------------------------------ - - java.net.Socket socket_; - java.io.InputStream rawSocketInputStream_; - java.io.OutputStream rawSocketOutputStream_; - - String server_; - int port_; - public CcsidManager sourceCcsidManager_; - public CcsidManager targetCcsidManager_; - public Typdef typdef_; - public Typdef targetTypdef_; - public Typdef originalTargetTypdef_; // added to support typdef overrides - - protected int svrcod_; - - public int orignalTargetSqlam_ = NetConfiguration.MGRLVL_7; - public int targetSqlam_ = orignalTargetSqlam_; - - public SqlException exceptionOpeningSocket_ = null; - //---------------------constructors/finalizer--------------------------------- - public NetAgent(NetConnection netConnection, - org.apache.derby.client.am.LogWriter logWriter) throws SqlException - { - super (netConnection, logWriter); - this.netConnection_ = netConnection; - } - - NetAgent (NetConnection netConnection, - org.apache.derby.client.am.LogWriter netLogWriter, - int loginTimeout, - String server, - int port) throws SqlException - { - super (netConnection, netLogWriter); - - server_ = server; - port_ = port; - netConnection_ = netConnection; - if (server_ == null) throw new SqlException (logWriter_, "Required property \"serverName\" not set"); - - try { - socket_ = (java.net.Socket) java.security.AccessController.doPrivileged (new OpenSocketAction(server, port)); - } - catch (java.security.PrivilegedActionException e) { - throw new SqlException( - logWriter_, - e.getException(), - e.getClass().getName() + " : Error opening socket to server " + server + " on port " + port + " with message : " + e.getMessage()); - } - - // Set TCP/IP Socket Properties - try { - if (exceptionOpeningSocket_ == null) { - socket_.setTcpNoDelay (true); // disables nagles algorithm - socket_.setKeepAlive (true); // PROTOCOL Manual: TCP/IP connection allocation rule #2 - socket_.setSoTimeout (loginTimeout*1000); - } - } - catch (java.net.SocketException e) { - try { socket_.close(); } catch (java.io.IOException doNothing) {} - exceptionOpeningSocket_ = new SqlException (logWriter_, e, - "SocketException '" + e.getMessage() + "'"); - } - - try { - if (exceptionOpeningSocket_ == null) { - rawSocketOutputStream_ = socket_.getOutputStream(); - rawSocketInputStream_ = socket_.getInputStream(); - } - } - catch (java.io.IOException e) { - try { socket_.close(); } catch (java.io.IOException doNothing) {} - exceptionOpeningSocket_ = new SqlException (logWriter_, e, "unable to open stream on socket"); - } - - sourceCcsidManager_ = new EbcdicCcsidManager(); // delete these - targetCcsidManager_ = sourceCcsidManager_; // delete these - - if (netConnection_.isXAConnection()) { - NetXAConnectionReply netXAConnectionReply_ = new NetXAConnectionReply (this, netConnection_.commBufferSize_); - netResultSetReply_ = (NetResultSetReply) netXAConnectionReply_; - netStatementReply_ = (NetStatementReply) netResultSetReply_; - netPackageReply_ = (NetPackageReply) netStatementReply_; - netConnectionReply_ = (NetConnectionReply) netPackageReply_; - reply_ = (Reply) netConnectionReply_; - - resultSetReply_ = new ResultSetReply (this, - netResultSetReply_, - netStatementReply_, - netConnectionReply_); - statementReply_ = (StatementReply) resultSetReply_; - packageReply_ = (ConnectionReply) statementReply_; - connectionReply_ = (ConnectionReply) packageReply_; - NetXAConnectionRequest netXAConnectionRequest_ = new NetXAConnectionRequest (this, sourceCcsidManager_, netConnection_.commBufferSize_); - netResultSetRequest_ = (NetResultSetRequest) netXAConnectionRequest_; - netStatementRequest_ = (NetStatementRequest) netResultSetRequest_; - netPackageRequest_ = (NetPackageRequest) netStatementRequest_; - netConnectionRequest_ = (NetConnectionRequest) netPackageRequest_; - request_ = (Request) netConnectionRequest_; - - resultSetRequest_ = (ResultSetRequestInterface) netResultSetRequest_; - statementRequest_ = (StatementRequestInterface) netStatementRequest_; - packageRequest_ = (NetConnectionRequest) netPackageRequest_; - connectionRequest_ = (ConnectionRequestInterface) netConnectionRequest_; - } - else { - netResultSetReply_ = new NetResultSetReply (this, netConnection_.commBufferSize_); - netStatementReply_ = (NetStatementReply) netResultSetReply_; - netPackageReply_ = (NetPackageReply) netStatementReply_; - netConnectionReply_ = (NetConnectionReply) netPackageReply_; - reply_ = (Reply) netConnectionReply_; - - resultSetReply_ = new ResultSetReply (this, - netResultSetReply_, - netStatementReply_, - netConnectionReply_); - statementReply_ = (StatementReply) resultSetReply_; - packageReply_ = (ConnectionReply) statementReply_; - connectionReply_ = (ConnectionReply) packageReply_; - netResultSetRequest_ = new NetResultSetRequest (this, sourceCcsidManager_, netConnection_.commBufferSize_); - netStatementRequest_ = (NetStatementRequest) netResultSetRequest_; - netPackageRequest_ = (NetPackageRequest) netStatementRequest_; - netConnectionRequest_ = (NetConnectionRequest) netPackageRequest_; - request_ = (Request) netConnectionRequest_; - - resultSetRequest_ = (ResultSetRequestInterface) netResultSetRequest_; - statementRequest_ = (StatementRequestInterface) netStatementRequest_; - packageRequest_ = (NetConnectionRequest) netPackageRequest_; - connectionRequest_ = (ConnectionRequestInterface) netConnectionRequest_; - } - } - - protected void resetAgent_ ( - org.apache.derby.client.am.LogWriter netLogWriter, - //CcsidManager sourceCcsidManager, - //CcsidManager targetCcsidManager, - int loginTimeout, - String server, - int port) throws SqlException - { - - // most properties will remain unchanged on connect reset. - targetTypdef_ = originalTargetTypdef_; - svrcod_ = 0; - - // Set TCP/IP Socket Properties - try { - socket_.setSoTimeout (loginTimeout*1000); - } - catch (java.net.SocketException e) { - try { socket_.close(); } catch (java.io.IOException doNothing) {} - throw new SqlException (logWriter_, e, "SocketException '" + e.getMessage() + "'"); - } - } - - - void setSvrcod (int svrcod) - { - if (svrcod > svrcod_) svrcod_ = svrcod; - } - - void clearSvrcod () - { - svrcod_ = CodePoint.SVRCOD_INFO; - } - - int getSvrcod() - { - return svrcod_; - } - - public void flush_ () throws DisconnectException - { - sendRequest (); - reply_.initialize (); - } - - // Close socket and its streams. - public void close_() throws SqlException - { - // can we just close the socket here, do we need to close streams individually - SqlException accumulatedExceptions = null; - if (rawSocketInputStream_ != null) { - try { - rawSocketInputStream_.close(); - } - catch (java.io.IOException e) { - // note when {6} = 0 it indicates the socket was closed. - // this should be ok since we are going to go an close the socket - // immediately following this call. - // changing {4} to e.getMessage() may require pub changes - accumulatedExceptions = - new SqlException (logWriter_, e, "A communication error has been detected. " + - "Communication protocol being used: {0}. " + - "Communication API being used: {1}. " + - "Location where the error was detected: {2}. " + - "Communication function detecting the error: {3}. " + - "Protocol specific error codes(s) {4}, {5}, {6}. " + - "TCP/IP " + "SOCKETS " + "Agent.close() " + - "InputStream.close() " + e.getMessage() +" " + "* " +"0"); - //"08001", - //-30081); - } - finally { - rawSocketInputStream_ = null; - } - } - - if (rawSocketOutputStream_ != null) { - try { - rawSocketOutputStream_.close(); - } - catch (java.io.IOException e) { +public class NetAgent extends Agent { + //---------------------navigational members----------------------------------- + + // All these request objects point to the same physical request object. + public ConnectionRequestInterface connectionRequest_; + public NetConnectionRequest packageRequest_; + public StatementRequestInterface statementRequest_; + public ResultSetRequestInterface resultSetRequest_; + + // All these reply objects point to the same physical reply object. + public ConnectionReply connectionReply_; + public ConnectionReply packageReply_; + public StatementReply statementReply_; + public ResultSetReply resultSetReply_; + + //---------------------navigational cheat-links------------------------------- + // Cheat-links are for convenience only, and are not part of the conceptual model. + // Warning: + // Cheat-links should only be defined for invariant state data. + // That is, the state data is set by the constructor and never changes. + + // Alias for (NetConnection) super.connection + NetConnection netConnection_; + + // Alias for (Request) super.*Request, all in one + // In the case of the NET implementation, these all point to the same physical request object. + protected Request request_; + public NetConnectionRequest netConnectionRequest_; + public NetPackageRequest netPackageRequest_; + public NetStatementRequest netStatementRequest_; + public NetResultSetRequest netResultSetRequest_; + + // Alias for (Reply) super.*Reply, all in one. + // In the case of the NET implementation, these all point to the same physical reply object. + protected Reply reply_; + public NetConnectionReply netConnectionReply_; + public NetPackageReply netPackageReply_; + public NetStatementReply netStatementReply_; + public NetResultSetReply netResultSetReply_; + + //-----------------------------state------------------------------------------ + + java.net.Socket socket_; + java.io.InputStream rawSocketInputStream_; + java.io.OutputStream rawSocketOutputStream_; + + String server_; + int port_; + public CcsidManager sourceCcsidManager_; + public CcsidManager targetCcsidManager_; + public Typdef typdef_; + public Typdef targetTypdef_; + public Typdef originalTargetTypdef_; // added to support typdef overrides + + protected int svrcod_; + + public int orignalTargetSqlam_ = NetConfiguration.MGRLVL_7; + public int targetSqlam_ = orignalTargetSqlam_; + + public SqlException exceptionOpeningSocket_ = null; + + //---------------------constructors/finalizer--------------------------------- + public NetAgent(NetConnection netConnection, + org.apache.derby.client.am.LogWriter logWriter) throws SqlException { + super(netConnection, logWriter); + this.netConnection_ = netConnection; + } + + NetAgent(NetConnection netConnection, + org.apache.derby.client.am.LogWriter netLogWriter, + int loginTimeout, + String server, + int port) throws SqlException { + super(netConnection, netLogWriter); + + server_ = server; + port_ = port; + netConnection_ = netConnection; + if (server_ == null) { + throw new SqlException(logWriter_, "Required property \"serverName\" not set"); + } + + try { + socket_ = (java.net.Socket) java.security.AccessController.doPrivileged(new OpenSocketAction(server, port)); + } catch (java.security.PrivilegedActionException e) { + throw new SqlException(logWriter_, + e.getException(), + e.getClass().getName() + " : Error opening socket to server " + server + " on port " + port + " with message : " + e.getMessage()); + } + + // Set TCP/IP Socket Properties + try { + if (exceptionOpeningSocket_ == null) { + socket_.setTcpNoDelay(true); // disables nagles algorithm + socket_.setKeepAlive(true); // PROTOCOL Manual: TCP/IP connection allocation rule #2 + socket_.setSoTimeout(loginTimeout * 1000); + } + } catch (java.net.SocketException e) { + try { + socket_.close(); + } catch (java.io.IOException doNothing) { + } + exceptionOpeningSocket_ = new SqlException(logWriter_, e, + "SocketException '" + e.getMessage() + "'"); + } + + try { + if (exceptionOpeningSocket_ == null) { + rawSocketOutputStream_ = socket_.getOutputStream(); + rawSocketInputStream_ = socket_.getInputStream(); + } + } catch (java.io.IOException e) { + try { + socket_.close(); + } catch (java.io.IOException doNothing) { + } + exceptionOpeningSocket_ = new SqlException(logWriter_, e, "unable to open stream on socket"); + } + + sourceCcsidManager_ = new EbcdicCcsidManager(); // delete these + targetCcsidManager_ = sourceCcsidManager_; // delete these + + if (netConnection_.isXAConnection()) { + NetXAConnectionReply netXAConnectionReply_ = new NetXAConnectionReply(this, netConnection_.commBufferSize_); + netResultSetReply_ = (NetResultSetReply) netXAConnectionReply_; + netStatementReply_ = (NetStatementReply) netResultSetReply_; + netPackageReply_ = (NetPackageReply) netStatementReply_; + netConnectionReply_ = (NetConnectionReply) netPackageReply_; + reply_ = (Reply) netConnectionReply_; + + resultSetReply_ = new ResultSetReply(this, + netResultSetReply_, + netStatementReply_, + netConnectionReply_); + statementReply_ = (StatementReply) resultSetReply_; + packageReply_ = (ConnectionReply) statementReply_; + connectionReply_ = (ConnectionReply) packageReply_; + NetXAConnectionRequest netXAConnectionRequest_ = new NetXAConnectionRequest(this, sourceCcsidManager_, netConnection_.commBufferSize_); + netResultSetRequest_ = (NetResultSetRequest) netXAConnectionRequest_; + netStatementRequest_ = (NetStatementRequest) netResultSetRequest_; + netPackageRequest_ = (NetPackageRequest) netStatementRequest_; + netConnectionRequest_ = (NetConnectionRequest) netPackageRequest_; + request_ = (Request) netConnectionRequest_; + + resultSetRequest_ = (ResultSetRequestInterface) netResultSetRequest_; + statementRequest_ = (StatementRequestInterface) netStatementRequest_; + packageRequest_ = (NetConnectionRequest) netPackageRequest_; + connectionRequest_ = (ConnectionRequestInterface) netConnectionRequest_; + } else { + netResultSetReply_ = new NetResultSetReply(this, netConnection_.commBufferSize_); + netStatementReply_ = (NetStatementReply) netResultSetReply_; + netPackageReply_ = (NetPackageReply) netStatementReply_; + netConnectionReply_ = (NetConnectionReply) netPackageReply_; + reply_ = (Reply) netConnectionReply_; + + resultSetReply_ = new ResultSetReply(this, + netResultSetReply_, + netStatementReply_, + netConnectionReply_); + statementReply_ = (StatementReply) resultSetReply_; + packageReply_ = (ConnectionReply) statementReply_; + connectionReply_ = (ConnectionReply) packageReply_; + netResultSetRequest_ = new NetResultSetRequest(this, sourceCcsidManager_, netConnection_.commBufferSize_); + netStatementRequest_ = (NetStatementRequest) netResultSetRequest_; + netPackageRequest_ = (NetPackageRequest) netStatementRequest_; + netConnectionRequest_ = (NetConnectionRequest) netPackageRequest_; + request_ = (Request) netConnectionRequest_; + + resultSetRequest_ = (ResultSetRequestInterface) netResultSetRequest_; + statementRequest_ = (StatementRequestInterface) netStatementRequest_; + packageRequest_ = (NetConnectionRequest) netPackageRequest_; + connectionRequest_ = (ConnectionRequestInterface) netConnectionRequest_; + } + } + + protected void resetAgent_(org.apache.derby.client.am.LogWriter netLogWriter, + //CcsidManager sourceCcsidManager, + //CcsidManager targetCcsidManager, + int loginTimeout, + String server, + int port) throws SqlException { + + // most properties will remain unchanged on connect reset. + targetTypdef_ = originalTargetTypdef_; + svrcod_ = 0; + + // Set TCP/IP Socket Properties + try { + socket_.setSoTimeout(loginTimeout * 1000); + } catch (java.net.SocketException e) { + try { + socket_.close(); + } catch (java.io.IOException doNothing) { + } + throw new SqlException(logWriter_, e, "SocketException '" + e.getMessage() + "'"); + } + } + + + void setSvrcod(int svrcod) { + if (svrcod > svrcod_) { + svrcod_ = svrcod; + } + } + + void clearSvrcod() { + svrcod_ = CodePoint.SVRCOD_INFO; + } + + int getSvrcod() { + return svrcod_; + } + + public void flush_() throws DisconnectException { + sendRequest(); + reply_.initialize(); + } + + // Close socket and its streams. + public void close_() throws SqlException { + // can we just close the socket here, do we need to close streams individually + SqlException accumulatedExceptions = null; + if (rawSocketInputStream_ != null) { + try { + rawSocketInputStream_.close(); + } catch (java.io.IOException e) { + // note when {6} = 0 it indicates the socket was closed. + // this should be ok since we are going to go an close the socket + // immediately following this call. + // changing {4} to e.getMessage() may require pub changes + accumulatedExceptions = + new SqlException(logWriter_, e, "A communication error has been detected. " + + "Communication protocol being used: {0}. " + + "Communication API being used: {1}. " + + "Location where the error was detected: {2}. " + + "Communication function detecting the error: {3}. " + + "Protocol specific error codes(s) {4}, {5}, {6}. " + + "TCP/IP " + "SOCKETS " + "Agent.close() " + + "InputStream.close() " + e.getMessage() + " " + "* " + "0"); + //"08001", + //-30081); + } finally { + rawSocketInputStream_ = null; + } + } + + if (rawSocketOutputStream_ != null) { + try { + rawSocketOutputStream_.close(); + } catch (java.io.IOException e) { + // note when {6} = 0 it indicates the socket was closed. + // this should be ok since we are going to go an close the socket + // immediately following this call. + // changing {4} to e.getMessage() may require pub changes + SqlException latestException = new SqlException(logWriter_, + e, + "A communication error has been detected. " + + "Communication protocol being used: {0}. " + + "Communication API being used: {1}. " + + "Location where the error was detected: {2}. " + + "Communication function detecting the error: {3}. " + + "Protocol specific error codes(s) {4}, {5}, {6}. " + + "TCP/IP " + "SOCKETS " + "Agent.close() " + + "OutputStream.close() " + e.getMessage() + " " + "* " + "0"); + accumulatedExceptions = Utils.accumulateSQLException(latestException, accumulatedExceptions); + } finally { + rawSocketOutputStream_ = null; + } + } + + if (socket_ != null) { + try { + socket_.close(); + } catch (java.io.IOException e) { + // again {6} = 0, indicates the socket was closed. + // maybe set {4} to e.getMessage(). + // do this for now and but may need to modify or + // add this to the message pubs. + SqlException latestException = new SqlException(logWriter_, + e, + "A communication error has been detected. " + + "Communication protocol being used: {0}. " + + "Communication API being used: {1}. " + + "Location where the error was detected: {2}. " + + "Communication function detecting the error: {3}. " + + "Protocol specific error codes(s) {4}, {5}, {6}. " + + "TCP/IP " + "SOCKETS " + "Agent.close() " + + "Socket.close() " + e.getMessage() + " " + "* " + "0"); + accumulatedExceptions = Utils.accumulateSQLException(latestException, accumulatedExceptions); + } finally { + socket_ = null; + } + } + + if (accumulatedExceptions != null) { + throw accumulatedExceptions; + } + } + + + protected void sendRequest() throws DisconnectException { + try { + request_.flush(rawSocketOutputStream_); + } catch (java.io.IOException e) { + throwCommunicationsFailure("NetAgent.sendRequest()", + "OutputStream.flush()", + e.getMessage(), + "*"); + } + } + + public java.io.InputStream getInputStream() { + return rawSocketInputStream_; + } + + public java.io.OutputStream getOutputStream() { + return rawSocketOutputStream_; + } + + void setInputStream(java.io.InputStream inputStream) { + rawSocketInputStream_ = inputStream; + } + + void setOutputStream(java.io.OutputStream outputStream) { + rawSocketOutputStream_ = outputStream; + } + + public void throwCommunicationsFailure(String location, + String function, + String rc1, + String rc2) throws org.apache.derby.client.am.DisconnectException { + //org.apache.derby.client.am.DisconnectException + //accumulateReadExceptionAndDisconnect // note when {6} = 0 it indicates the socket was closed. - // this should be ok since we are going to go an close the socket - // immediately following this call. - // changing {4} to e.getMessage() may require pub changes - SqlException latestException = new SqlException ( - logWriter_, - e, - "A communication error has been detected. " + - "Communication protocol being used: {0}. " + - "Communication API being used: {1}. " + - "Location where the error was detected: {2}. " + - "Communication function detecting the error: {3}. " + - "Protocol specific error codes(s) {4}, {5}, {6}. " + - "TCP/IP " + "SOCKETS " + "Agent.close() " + - "OutputStream.close() " + e.getMessage() +" " + "* " +"0"); - accumulatedExceptions = Utils.accumulateSQLException (latestException, accumulatedExceptions); - } - finally { - rawSocketOutputStream_ = null; - } - } - - if (socket_ != null) { - try { - socket_.close(); - } - catch (java.io.IOException e) { - // again {6} = 0, indicates the socket was closed. - // maybe set {4} to e.getMessage(). - // do this for now and but may need to modify or - // add this to the message pubs. - SqlException latestException = new SqlException ( - logWriter_, - e, - "A communication error has been detected. " + - "Communication protocol being used: {0}. " + - "Communication API being used: {1}. " + - "Location where the error was detected: {2}. " + - "Communication function detecting the error: {3}. " + - "Protocol specific error codes(s) {4}, {5}, {6}. " + - "TCP/IP " + "SOCKETS " + "Agent.close() " + - "Socket.close() " + e.getMessage() + " " + "* " +"0"); - accumulatedExceptions = Utils.accumulateSQLException (latestException, accumulatedExceptions); - } - finally { - socket_ = null; - } - } - - if (accumulatedExceptions != null) - throw accumulatedExceptions; - } - - - protected void sendRequest () throws DisconnectException - { - try { - request_.flush (rawSocketOutputStream_); - } - catch (java.io.IOException e) { - throwCommunicationsFailure ( - "NetAgent.sendRequest()", - "OutputStream.flush()", - e.getMessage(), - "*"); - } - } - - public java.io.InputStream getInputStream () { return rawSocketInputStream_; } - public java.io.OutputStream getOutputStream () { return rawSocketOutputStream_; } - - void setInputStream (java.io.InputStream inputStream) - { rawSocketInputStream_ = inputStream; } - - void setOutputStream (java.io.OutputStream outputStream) - { rawSocketOutputStream_ = outputStream; } - - public void throwCommunicationsFailure (String location, - String function, - String rc1, - String rc2) throws org.apache.derby.client.am.DisconnectException - { - //org.apache.derby.client.am.DisconnectException - //accumulateReadExceptionAndDisconnect - // note when {6} = 0 it indicates the socket was closed. - // need to still validate any token values against message publications. - accumulateChainBreakingReadExceptionAndThrow ( - new org.apache.derby.client.am.DisconnectException ( - this, - "A communication error has been detected. " + - "Communication protocol being used: " + location + ". " + - "Communication API being used: " + function + ". " + - "Location where the error was detected: " + rc1 + ". " + - "Communication function detecting the error: " + rc2 + ". " + - "Protocol specific error codes(s) " + - "TCP/IP SOCKETS ")); // hardcode tokens 0 and 1 + // need to still validate any token values against message publications. + accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(this, + "A communication error has been detected. " + + "Communication protocol being used: " + location + ". " + + "Communication API being used: " + function + ". " + + "Location where the error was detected: " + rc1 + ". " + + "Communication function detecting the error: " + rc2 + ". " + + "Protocol specific error codes(s) " + + "TCP/IP SOCKETS ")); // hardcode tokens 0 and 1 //"08001")); //derby code -30081, don't send 08001 now either - } + } + + // ----------------------- call-down methods --------------------------------- + + public org.apache.derby.client.am.LogWriter newLogWriter_(java.io.PrintWriter printWriter, + int traceLevel) { + return new NetLogWriter(printWriter, traceLevel); + } + + protected void markChainBreakingException_() { + setSvrcod(CodePoint.SVRCOD_ERROR); + } + + public void checkForChainBreakingException_() throws SqlException { + int svrcod = getSvrcod(); + clearSvrcod(); + if (svrcod > CodePoint.SVRCOD_WARNING) // Not for SQL warning, if svrcod > WARNING, then its a chain breaker + { + super.checkForExceptions(); // throws the accumulated exceptions, we'll always have at least one. + } + } + + private void writeDeferredResetConnection() throws SqlException { + if (!netConnection_.resetConnectionAtFirstSql_) { + return; + } + try { + netConnection_.writeDeferredReset(); + } catch (SqlException sqle) { + DisconnectException de = new DisconnectException(this, "An error occurred during a deferred connect reset and the connection has been terminated. See chained exceptions for details."); + de.setNextException(sqle); + throw de; + } + } + + public void beginWriteChainOutsideUOW() throws SqlException { + request_.initialize(); + writeDeferredResetConnection(); + super.beginWriteChainOutsideUOW(); + } - // ----------------------- call-down methods --------------------------------- + public void beginWriteChain(org.apache.derby.client.am.Statement statement) throws SqlException { + request_.initialize(); + writeDeferredResetConnection(); + super.beginWriteChain(statement); + } - public org.apache.derby.client.am.LogWriter newLogWriter_ (java.io.PrintWriter printWriter, - int traceLevel) - { - return new NetLogWriter (printWriter, traceLevel); - } - - protected void markChainBreakingException_ () - { - setSvrcod (CodePoint.SVRCOD_ERROR); - } - - public void checkForChainBreakingException_ () throws SqlException - { - int svrcod = getSvrcod(); - clearSvrcod(); - if (svrcod > CodePoint.SVRCOD_WARNING) // Not for SQL warning, if svrcod > WARNING, then its a chain breaker - super.checkForExceptions(); // throws the accumulated exceptions, we'll always have at least one. - } - - private void writeDeferredResetConnection() throws SqlException - { - if (!netConnection_.resetConnectionAtFirstSql_) return; - try { - netConnection_.writeDeferredReset(); - } - catch (SqlException sqle) { - DisconnectException de = new DisconnectException ( - this,"An error occurred during a deferred connect reset and the connection has been terminated. See chained exceptions for details."); - de.setNextException(sqle); - throw de; - } - } - - public void beginWriteChainOutsideUOW () throws SqlException - { - request_.initialize(); - writeDeferredResetConnection(); - super.beginWriteChainOutsideUOW (); - } - - public void beginWriteChain (org.apache.derby.client.am.Statement statement) throws SqlException - { - request_.initialize(); - writeDeferredResetConnection(); - super.beginWriteChain (statement); - } - - protected void endWriteChain () - { - super.endWriteChain(); - } - - private void readDeferredResetConnection() throws SqlException - { - if (!netConnection_.resetConnectionAtFirstSql_) return; - try { - netConnection_.readDeferredReset(); - checkForExceptions(); - } - catch (SqlException sqle) { - DisconnectException de = new DisconnectException ( - this,"An error occurred during a deferred connect reset and the connection has been terminated. See chained exceptions for details."); - de.setNextException(sqle); - throw de; - } - } - - protected void beginReadChain (org.apache.derby.client.am.Statement statement) throws SqlException - { - readDeferredResetConnection(); - super.beginReadChain (statement); - } - - protected void beginReadChainOutsideUOW () throws SqlException - { - readDeferredResetConnection(); - super.beginReadChainOutsideUOW(); - } - - public void endReadChain () throws SqlException - { - super.endReadChain(); - } - - - public String convertToStringTcpIpAddress (int tcpIpAddress) - { - StringBuffer ipAddrBytes = new StringBuffer(); - ipAddrBytes.append ((tcpIpAddress >> 24) & 0xff); - ipAddrBytes.append ("."); - ipAddrBytes.append ((tcpIpAddress >> 16) & 0xff); - ipAddrBytes.append ("."); - ipAddrBytes.append ((tcpIpAddress >> 8) & 0xff); - ipAddrBytes.append ("."); - ipAddrBytes.append ((tcpIpAddress) & 0xff); - - return ipAddrBytes.toString(); - } - - protected int getPort() - { - return port_; - } + protected void endWriteChain() { + super.endWriteChain(); + } + + private void readDeferredResetConnection() throws SqlException { + if (!netConnection_.resetConnectionAtFirstSql_) { + return; + } + try { + netConnection_.readDeferredReset(); + checkForExceptions(); + } catch (SqlException sqle) { + DisconnectException de = new DisconnectException(this, "An error occurred during a deferred connect reset and the connection has been terminated. See chained exceptions for details."); + de.setNextException(sqle); + throw de; + } + } + + protected void beginReadChain(org.apache.derby.client.am.Statement statement) throws SqlException { + readDeferredResetConnection(); + super.beginReadChain(statement); + } + + protected void beginReadChainOutsideUOW() throws SqlException { + readDeferredResetConnection(); + super.beginReadChainOutsideUOW(); + } + + public void endReadChain() throws SqlException { + super.endReadChain(); + } + + + public String convertToStringTcpIpAddress(int tcpIpAddress) { + StringBuffer ipAddrBytes = new StringBuffer(); + ipAddrBytes.append((tcpIpAddress >> 24) & 0xff); + ipAddrBytes.append("."); + ipAddrBytes.append((tcpIpAddress >> 16) & 0xff); + ipAddrBytes.append("."); + ipAddrBytes.append((tcpIpAddress >> 8) & 0xff); + ipAddrBytes.append("."); + ipAddrBytes.append((tcpIpAddress) & 0xff); + + return ipAddrBytes.toString(); + } + + protected int getPort() { + return port_; + } } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetCallableStatement.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetCallableStatement.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetCallableStatement.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetCallableStatement.java Sun May 1 23:25:59 2005 @@ -20,103 +20,92 @@ package org.apache.derby.client.net; import org.apache.derby.client.am.CallableStatement; -import org.apache.derby.client.am.Section; import org.apache.derby.client.am.ColumnMetaData; -import org.apache.derby.client.am.SqlException; import org.apache.derby.client.am.MaterialPreparedStatement; +import org.apache.derby.client.am.Section; +import org.apache.derby.client.am.SqlException; public class NetCallableStatement extends NetPreparedStatement - implements MaterialPreparedStatement -{ + implements MaterialPreparedStatement { - CallableStatement callableStatement_; + CallableStatement callableStatement_; - //-----------------------------state------------------------------------------ + //-----------------------------state------------------------------------------ - //---------------------constructors/finalizer--------------------------------- + //---------------------constructors/finalizer--------------------------------- - private void initNetCallableStatement() - { - callableStatement_ = null; - } - - // Relay constructor for all NetCallableStatement constructors - NetCallableStatement (CallableStatement statement, - NetAgent netAgent, - NetConnection netConnection) throws SqlException - { - super (statement, netAgent, netConnection); - initNetCallableStatement(); - initNetCallableStatement (statement); - } - - void resetNetCallableStatement (CallableStatement statement, - NetAgent netAgent, - NetConnection netConnection) throws SqlException - { - super.resetNetPreparedStatement(statement, netAgent, netConnection); - initNetCallableStatement(); - initNetCallableStatement (statement); - } - - private void initNetCallableStatement (CallableStatement statement - ) throws SqlException - { - callableStatement_ = statement; - callableStatement_.materialCallableStatement_ = this; - - } - - - // Called by abstract Connection.prepareCall().newCallableStatement() - // for jdbc 2 callable statements with scroll attributes. - NetCallableStatement (NetAgent netAgent, - NetConnection netConnection, - String sql, - int type, - int concurrency, - int holdability) throws SqlException - { - this (new CallableStatement (netAgent, netConnection, sql, type, concurrency, holdability), - netAgent, - netConnection); - } - - void resetNetCallableStatement (NetAgent netAgent, - NetConnection netConnection, - String sql, - int type, - int concurrency, - int holdability) throws SqlException - { - callableStatement_.resetCallableStatement(netAgent, netConnection, sql, type, concurrency, holdability); - resetNetCallableStatement(callableStatement_, netAgent, netConnection); - } - - void resetNetCallableStatement (NetAgent netAgent, - NetConnection netConnection, - String sql, - Section section) throws SqlException - { - callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section); - resetNetCallableStatement(callableStatement_, netAgent, netConnection); - } - - - void resetNetCallableStatement (NetAgent netAgent, - NetConnection netConnection, - String sql, - Section section, - ColumnMetaData parameterMetaData, - ColumnMetaData resultSetMetaData) throws SqlException - { - callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData); - resetNetCallableStatement(callableStatement_, netAgent, netConnection); - } - - protected void finalize () throws java.lang.Throwable - { - super.finalize(); - } + private void initNetCallableStatement() { + callableStatement_ = null; + } + + // Relay constructor for all NetCallableStatement constructors + NetCallableStatement(CallableStatement statement, + NetAgent netAgent, + NetConnection netConnection) throws SqlException { + super(statement, netAgent, netConnection); + initNetCallableStatement(); + initNetCallableStatement(statement); + } + + void resetNetCallableStatement(CallableStatement statement, + NetAgent netAgent, + NetConnection netConnection) throws SqlException { + super.resetNetPreparedStatement(statement, netAgent, netConnection); + initNetCallableStatement(); + initNetCallableStatement(statement); + } + + private void initNetCallableStatement(CallableStatement statement) throws SqlException { + callableStatement_ = statement; + callableStatement_.materialCallableStatement_ = this; + + } + + + // Called by abstract Connection.prepareCall().newCallableStatement() + // for jdbc 2 callable statements with scroll attributes. + NetCallableStatement(NetAgent netAgent, + NetConnection netConnection, + String sql, + int type, + int concurrency, + int holdability) throws SqlException { + this(new CallableStatement(netAgent, netConnection, sql, type, concurrency, holdability), + netAgent, + netConnection); + } + + void resetNetCallableStatement(NetAgent netAgent, + NetConnection netConnection, + String sql, + int type, + int concurrency, + int holdability) throws SqlException { + callableStatement_.resetCallableStatement(netAgent, netConnection, sql, type, concurrency, holdability); + resetNetCallableStatement(callableStatement_, netAgent, netConnection); + } + + void resetNetCallableStatement(NetAgent netAgent, + NetConnection netConnection, + String sql, + Section section) throws SqlException { + callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section); + resetNetCallableStatement(callableStatement_, netAgent, netConnection); + } + + + void resetNetCallableStatement(NetAgent netAgent, + NetConnection netConnection, + String sql, + Section section, + ColumnMetaData parameterMetaData, + ColumnMetaData resultSetMetaData) throws SqlException { + callableStatement_.resetCallableStatement(netAgent, netConnection, sql, section, parameterMetaData, resultSetMetaData); + resetNetCallableStatement(callableStatement_, netAgent, netConnection); + } + + protected void finalize() throws java.lang.Throwable { + super.finalize(); + } } Modified: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java?rev=165585&r1=165584&r2=165585&view=diff ============================================================================== --- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java (original) +++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java Sun May 1 23:25:59 2005 @@ -18,151 +18,151 @@ */ package org.apache.derby.client.net; + import org.apache.derby.client.am.Version; -public class NetConfiguration -{ - // --------------------------------------------------------------------------- +public class NetConfiguration { + // --------------------------------------------------------------------------- - static final int INITIAL_CAPACITY = 10; // initial size of the Vector for the input parameters + static final int INITIAL_CAPACITY = 10; // initial size of the Vector for the input parameters - // Value to use when padding non-character data in ddm objects. - public static final byte NON_CHAR_DDM_DATA_PAD_BYTE = 0x00; + // Value to use when padding non-character data in ddm objects. + public static final byte NON_CHAR_DDM_DATA_PAD_BYTE = 0x00; - static final int CURSOR_NOT_OPEN = 0; - static final int CURSOR_OPEN = 1; - static final int CURSOR_CLOSE_ONLY = 2; + static final int CURSOR_NOT_OPEN = 0; + static final int CURSOR_OPEN = 1; + static final int CURSOR_CLOSE_ONLY = 2; - // Number of bytes in the DDM header. - static final int DDMHDR_LENGTH = 4; + // Number of bytes in the DDM header. + static final int DDMHDR_LENGTH = 4; - // Number of bytes in the DSS header. - static final int DSSHDR_LENGTH = 6; + // Number of bytes in the DSS header. + static final int DSSHDR_LENGTH = 6; - // Maximum size of External Name. - static final int EXTNAM_MAXSIZE = 255; + // Maximum size of External Name. + static final int EXTNAM_MAXSIZE = 255; - // Minimum agent level required by protocol. - static final int MIN_AGENT_MGRLVL = 3; + // Minimum agent level required by protocol. + static final int MIN_AGENT_MGRLVL = 3; - // Minimum communications tcpip manager level required by protocol. - static final int MIN_CMNTCPIP_MGRLVL = 5; + // Minimum communications tcpip manager level required by protocol. + static final int MIN_CMNTCPIP_MGRLVL = 5; - // Minimum LU6.2 Conversational Communications Manager - static final int MIN_CMNAPPC_MGRLVL = 3; + // Minimum LU6.2 Conversational Communications Manager + static final int MIN_CMNAPPC_MGRLVL = 3; - // Minimum rdb manager level required by protocol. - static final int MIN_RDB_MGRLVL = 3; + // Minimum rdb manager level required by protocol. + static final int MIN_RDB_MGRLVL = 3; - // Minimum secmgr manager level required by protocol. - static final int MIN_SECMGR_MGRLVL = 5; + // Minimum secmgr manager level required by protocol. + static final int MIN_SECMGR_MGRLVL = 5; - // Minimum sqlam manager level required by protocol. - static final int MIN_SQLAM_MGRLVL = 4; + // Minimum sqlam manager level required by protocol. + static final int MIN_SQLAM_MGRLVL = 4; - // Minimum xa manager level required by protocol. - static final int MIN_XAMGR_MGRLVL = 7; + // Minimum xa manager level required by protocol. + static final int MIN_XAMGR_MGRLVL = 7; - // Minimum secmgr manager level required by protocol. - static final int MIN_SYNCPTMGR_MGRLVL = 5; + // Minimum secmgr manager level required by protocol. + static final int MIN_SYNCPTMGR_MGRLVL = 5; - // Minimum sqlam manager level required by protocol. - static final int MIN_RSYNCMGR_MGRLVL = 5; + // Minimum sqlam manager level required by protocol. + static final int MIN_RSYNCMGR_MGRLVL = 5; - // Maximun Password size. - static final int PASSWORD_MAXSIZE = 255; + // Maximun Password size. + static final int PASSWORD_MAXSIZE = 255; - // Fixed PRDDTA application id fixed length. - public static final int PRDDTA_APPL_ID_FIXED_LEN = 20; + // Fixed PRDDTA application id fixed length. + public static final int PRDDTA_APPL_ID_FIXED_LEN = 20; - // PRDDTA Accounting Suffix Length byte offset. - static final int PRDDTA_ACCT_SUFFIX_LEN_BYTE = 55; + // PRDDTA Accounting Suffix Length byte offset. + static final int PRDDTA_ACCT_SUFFIX_LEN_BYTE = 55; - // PRDDTA Max Accounting Suffix Length. - static final int PRDDTA_MAX_ACCT_SUFFIX_LEN = 199; + // PRDDTA Max Accounting Suffix Length. + static final int PRDDTA_MAX_ACCT_SUFFIX_LEN = 199; - // PRDDTA Length byte offset. - static final int PRDDTA_LEN_BYTE = 0; + // PRDDTA Length byte offset. + static final int PRDDTA_LEN_BYTE = 0; - // Maximum PRDDTA size. - static final int PRDDTA_MAXSIZE = 255; + // Maximum PRDDTA size. + static final int PRDDTA_MAXSIZE = 255; - // PRDDTA platform id. - public static final String PRDDTA_PLATFORM_ID = "JVM "; + // PRDDTA platform id. + public static final String PRDDTA_PLATFORM_ID = "JVM "; - // Fixed PRDDTA user id fixed length. - public static final int PRDDTA_USER_ID_FIXED_LEN = 8; + // Fixed PRDDTA user id fixed length. + public static final int PRDDTA_USER_ID_FIXED_LEN = 8; - // Identifier Length for fixed length rdb name - public static final int PKG_IDENTIFIER_FIXED_LEN = 18; + // Identifier Length for fixed length rdb name + public static final int PKG_IDENTIFIER_FIXED_LEN = 18; - // Maximum RDB Identifier Length - static final int PKG_IDENTIFIER_MAX_LEN = 255; + // Maximum RDB Identifier Length + static final int PKG_IDENTIFIER_MAX_LEN = 255; - // Fixed pkgcnstkn length - public static final int PKGCNSTKN_FIXED_LEN = 8; + // Fixed pkgcnstkn length + public static final int PKGCNSTKN_FIXED_LEN = 8; - // Maximum length of a security token. - // Anything greater than 32763 bytes of SECTKN would require extended length DDMs. - // This seems like an impossible upper bound limit right now so set - // max to 32763 and cross bridge later. - static final int SECTKN_MAXSIZE = 32763; // this was 255 + // Maximum length of a security token. + // Anything greater than 32763 bytes of SECTKN would require extended length DDMs. + // This seems like an impossible upper bound limit right now so set + // max to 32763 and cross bridge later. + static final int SECTKN_MAXSIZE = 32763; // this was 255 - // Server class name of the ClientDNC product. - static final String SRVCLSNM_JVM = "QDERBY/JVM"; + // Server class name of the ClientDNC product. + static final String SRVCLSNM_JVM = "QDERBY/JVM"; - // Maximum size of SRVNAM Name. - static final int SRVNAM_MAXSIZE = 255; + // Maximum size of SRVNAM Name. + static final int SRVNAM_MAXSIZE = 255; - // Manager is NA or not usued. - static final int MGRLVL_NA = 0; + // Manager is NA or not usued. + static final int MGRLVL_NA = 0; - // Manager Level 3 constant. - static final int MGRLVL_3 = 0x03; + // Manager Level 3 constant. + static final int MGRLVL_3 = 0x03; - // Manager Level 4 constant. - static final int MGRLVL_4 = 0x04; + // Manager Level 4 constant. + static final int MGRLVL_4 = 0x04; - // Manager Level 5 constant. - static final int MGRLVL_5 = 0x05; + // Manager Level 5 constant. + static final int MGRLVL_5 = 0x05; - // Manager level 6 constant. - static final int MGRLVL_6 = 0x06; + // Manager level 6 constant. + static final int MGRLVL_6 = 0x06; - // Manager Level 7 constant. - static final public int MGRLVL_7 = 0x07; + // Manager Level 7 constant. + static final public int MGRLVL_7 = 0x07; - // Indicates the DCE security mechanism. - static final int SECMEC_DCESEC = 0x01; + // Indicates the DCE security mechanism. + static final int SECMEC_DCESEC = 0x01; - // Indicates encrypted userid, password, - // new password security mechanism. - static final int SECMEC_EUSRIDNWPWD = 0x0A; + // Indicates encrypted userid, password, + // new password security mechanism. + static final int SECMEC_EUSRIDNWPWD = 0x0A; - // Indicates userid/encrypted password security mechanism. - public static final int SECMEC_EUSRIDPWD = 0x09; + // Indicates userid/encrypted password security mechanism. + public static final int SECMEC_EUSRIDPWD = 0x09; - // Indicates userid only security mechanism. - public static final int SECMEC_USRIDONL = 0x04; + // Indicates userid only security mechanism. + public static final int SECMEC_USRIDONL = 0x04; - // Indicates userid/encrypted password security mechanism. - public static final int SECMEC_USRENCPWD = 0x07; + // Indicates userid/encrypted password security mechanism. + public static final int SECMEC_USRENCPWD = 0x07; - // Indicates userid/new password security mechanism. - static final int SECMEC_USRIDNWPWD = 0x05; + // Indicates userid/new password security mechanism. + static final int SECMEC_USRIDNWPWD = 0x05; - // Indicates userid/password security mechanism. - public static final int SECMEC_USRIDPWD = 0x03; + // Indicates userid/password security mechanism. + public static final int SECMEC_USRIDPWD = 0x03; - //Indicates Encrypted userid and Encrypted Security-sensitive Data security mechanism - public static final int SECMEC_EUSRIDDTA = 0x0C; + //Indicates Encrypted userid and Encrypted Security-sensitive Data security mechanism + public static final int SECMEC_EUSRIDDTA = 0x0C; - //Indicates Encrypted userid,Encrypted password and Encrypted Security-sensitive Data security mechanism - public static final int SECMEC_EUSRPWDDTA = 0x0D; + //Indicates Encrypted userid,Encrypted password and Encrypted Security-sensitive Data security mechanism + public static final int SECMEC_EUSRPWDDTA = 0x0D; - // list of security mechanisms supported by this driver - static final int[] SECMGR_SECMECS = {NetConfiguration.SECMEC_EUSRIDPWD, + // list of security mechanisms supported by this driver + static final int[] SECMGR_SECMECS = {NetConfiguration.SECMEC_EUSRIDPWD, NetConfiguration.SECMEC_USRENCPWD, NetConfiguration.SECMEC_USRIDPWD, NetConfiguration.SECMEC_USRIDONL, @@ -170,45 +170,47 @@ NetConfiguration.SECMEC_EUSRPWDDTA}; - // IEEE ASCII constant. - public static final String SYSTEM_ASC = "QTDSQLASC"; + // IEEE ASCII constant. + public static final String SYSTEM_ASC = "QTDSQLASC"; - // JVM constant. - static final String SYSTEM_JVM = "QTDSQLJVM"; + // JVM constant. + static final String SYSTEM_JVM = "QTDSQLJVM"; - // Maximum size of User Name. - static final int USRID_MAXSIZE = 255; + // Maximum size of User Name. + static final int USRID_MAXSIZE = 255; - // Product id of the ClientDNC. - public static String PRDID; - - // The server release level of this product. - // It will be prefixed with PRDID - static String SRVRLSLV; - - // Initialize PRDID and SRVRLSLV - static { - int majorVersion = Version.getMajorVersion(); - int minorVersion = Version.getMinorVersion(); - int protocolMaintVersion = Version.getProtocolMaintVersion(); - - // PRDID format as Network Server expects it: DNCMMmx - // MM = major version - // mm = minor version - // x = protocol MaintenanceVersion - - String prdId = "DNC"; - if (majorVersion < 10) - prdId += "0"; - prdId += majorVersion; - - if (minorVersion < 10) - prdId += "0"; - - prdId += minorVersion; - prdId += protocolMaintVersion; - PRDID = prdId; - SRVRLSLV = prdId + "/" + Version.getDriverVersion(); - } + // Product id of the ClientDNC. + public static String PRDID; + + // The server release level of this product. + // It will be prefixed with PRDID + static String SRVRLSLV; + + // Initialize PRDID and SRVRLSLV + static { + int majorVersion = Version.getMajorVersion(); + int minorVersion = Version.getMinorVersion(); + int protocolMaintVersion = Version.getProtocolMaintVersion(); + + // PRDID format as Network Server expects it: DNCMMmx + // MM = major version + // mm = minor version + // x = protocol MaintenanceVersion + + String prdId = "DNC"; + if (majorVersion < 10) { + prdId += "0"; + } + prdId += majorVersion; + + if (minorVersion < 10) { + prdId += "0"; + } + + prdId += minorVersion; + prdId += protocolMaintVersion; + PRDID = prdId; + SRVRLSLV = prdId + "/" + Version.getDriverVersion(); + } }