db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r165178 [14/26] - in /incubator/derby/code/trunk: ./ java/client/ java/client/org/ java/client/org/apache/ java/client/org/apache/derby/ java/client/org/apache/derby/client/ java/client/org/apache/derby/client/am/ java/client/org/apache/derby/client/net/ java/client/org/apache/derby/client/resources/ java/client/org/apache/derby/jdbc/ tools/ant/properties/
Date Thu, 28 Apr 2005 19:05:45 GMT
Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,167 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.Types
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+package org.apache.derby.client.am;
+
+// This enumeration of types represents the typing scheme used by our jdbc driver.
+// Once this is finished, we need to review our switches to make sure they are exhaustive
+public class Types
+{
+  // -------------------------------- Driver types -------------------------------------------------
+
+  // Not currently supported as a DERBY column type.  Mapped to SMALLINT.
+  // public final static int BIT        =  java.sql.Types.BIT;          // -7;
+
+  // Not currently supported as a DERBY column type.  Mapped to SMALLINT.
+  //public final static int TINYINT 	= java.sql.Types.TINYINT;       // -6;
+
+  public final static int SMALLINT	= java.sql.Types.SMALLINT;      // 5;
+
+  public final static int INTEGER 	= java.sql.Types.INTEGER;       // 4;
+
+  public final static int BIGINT 	= java.sql.Types.BIGINT;        // -5;
+
+  // We type using DOUBLE
+  //public final static int FLOAT 	= java.sql.Types.FLOAT;         // 6;
+
+  public final static int REAL 		= java.sql.Types.REAL;          // 7;
+
+  public final static int DOUBLE 	= java.sql.Types.DOUBLE;        // 8;
+
+  // We type using DECIMAL
+  //public final static int NUMERIC 	= java.sql.Types.NUMERIC;       // 2;
+
+  public final static int DECIMAL	= java.sql.Types.DECIMAL;       // 3;
+
+  public final static int CHAR		= java.sql.Types.CHAR;          // 1;
+
+  public final static int VARCHAR 	= java.sql.Types.VARCHAR;       // 12;
+
+  public final static int LONGVARCHAR 	= java.sql.Types.LONGVARCHAR;   // -1;
+
+  public final static int DATE 		= java.sql.Types.DATE;          // 91;
+
+  public final static int TIME 		= java.sql.Types.TIME;          // 92;
+
+  public final static int TIMESTAMP 	= java.sql.Types.TIMESTAMP;     // 93;
+
+  public final static int BINARY	= java.sql.Types.BINARY;        // -2;
+
+  public final static int VARBINARY 	= java.sql.Types.VARBINARY;     // -3;
+
+  public final static int LONGVARBINARY = java.sql.Types.LONGVARBINARY; // -4;
+
+  public final static int BLOB          = java.sql.Types.BLOB;          // 2004;
+
+  public final static int CLOB          = java.sql.Types.CLOB;          // 2005;
+
+  // hide the default constructor
+  private Types() {}
+
+  // -------------------------------- DERBY types ----------------------------------------------------
+
+  public final static int DERBY_SQLTYPE_DATE = 384;        // DATE
+  public final static int DERBY_SQLTYPE_NDATE = 385;
+  public final static int DERBY_SQLTYPE_TIME = 388;        // TIME
+  public final static int DERBY_SQLTYPE_NTIME = 389;
+  public final static int DERBY_SQLTYPE_TIMESTAMP = 392;   // TIMESTAMP
+  public final static int DERBY_SQLTYPE_NTIMESTAMP = 393;
+
+  public final static int DERBY_SQLTYPE_BLOB = 404;        // BLOB
+  public final static int DERBY_SQLTYPE_NBLOB = 405;
+  public final static int DERBY_SQLTYPE_CLOB = 408;        // CLOB
+  public final static int DERBY_SQLTYPE_NCLOB = 409;
+
+  public final static int DERBY_SQLTYPE_VARCHAR = 448;     // VARCHAR(i) - varying length string
+  public final static int DERBY_SQLTYPE_NVARCHAR = 449;
+  public final static int DERBY_SQLTYPE_CHAR = 452;        // CHAR(i) - fixed length
+  public final static int DERBY_SQLTYPE_NCHAR = 453;
+  public final static int DERBY_SQLTYPE_LONG = 456;        // LONG VARCHAR - varying length string
+  public final static int DERBY_SQLTYPE_NLONG = 457;
+  public final static int DERBY_SQLTYPE_CSTR = 460;        // SBCS - null terminated
+  public final static int DERBY_SQLTYPE_NCSTR = 461;
+
+  public final static int DERBY_SQLTYPE_FLOAT = 480;       // FLOAT - 4 or 8 byte floating point
+  public final static int DERBY_SQLTYPE_NFLOAT = 481;
+  public final static int DERBY_SQLTYPE_DECIMAL = 484;     // DECIMAL (m,n)
+  public final static int DERBY_SQLTYPE_NDECIMAL = 485;
+  public final static int DERBY_SQLTYPE_BIGINT = 492;      // BIGINT - 8-byte signed integer
+  public final static int DERBY_SQLTYPE_NBIGINT = 493;
+  public final static int DERBY_SQLTYPE_INTEGER = 496;     // INTEGER
+  public final static int DERBY_SQLTYPE_NINTEGER = 497;
+  public final static int DERBY_SQLTYPE_SMALL = 500;       // SMALLINT - 2-byte signed integer                                                                    */
+  public final static int DERBY_SQLTYPE_NSMALL = 501;
+
+  public final static int DERBY_SQLTYPE_NUMERIC = 504;     // NUMERIC -> DECIMAL (m,n)
+  public final static int DERBY_SQLTYPE_NNUMERIC = 505;
+
+  static public int mapDERBYTypeToDriverType (boolean isDescribed, int sqlType, long length, int ccsid)
+  {
+    switch (Utils.getNonNullableSqlType (sqlType)) { // mask the isNullable bit
+    case DERBY_SQLTYPE_SMALL:
+      return SMALLINT;
+    case DERBY_SQLTYPE_INTEGER:
+      return INTEGER;
+    case DERBY_SQLTYPE_BIGINT:
+      return BIGINT;
+    case DERBY_SQLTYPE_FLOAT:
+      if (length == 16)                  // can map to either NUMERIC or DECIMAL
+        return DECIMAL;
+      else if (length == 8)              // can map to either DOUBLE or FLOAT
+        return DOUBLE;
+      else if (length == 4)
+        return REAL;
+      else
+        return 0;
+    case DERBY_SQLTYPE_DECIMAL:            // can map to either NUMERIC or DECIMAL
+    case DERBY_SQLTYPE_NUMERIC:            // can map to either NUMERIC or DECIMAL
+      return DECIMAL;
+    case DERBY_SQLTYPE_CHAR:    // mixed and single byte
+      if (isDescribed && (ccsid == 0xffff || ccsid == 0))
+        return BINARY;
+      else
+        return CHAR;
+    case DERBY_SQLTYPE_CSTR:    // null terminated SBCS/Mixed
+      return CHAR;
+    // use ccsid to distinguish between BINARY and CHAR, VARBINARY and VARCHAR, LONG... 
+    case DERBY_SQLTYPE_VARCHAR:   // variable character SBCS/Mixed
+      if (isDescribed && (ccsid == 0xffff || ccsid == 0))
+        return VARBINARY;
+      else
+        return VARCHAR;
+    case DERBY_SQLTYPE_LONG:      // long varchar SBCS/Mixed
+      if (isDescribed && (ccsid == 0xffff || ccsid == 0))
+        return LONGVARBINARY;
+      else
+        return LONGVARCHAR;
+    case DERBY_SQLTYPE_DATE:
+      return DATE;
+    case DERBY_SQLTYPE_TIME:
+      return TIME;
+    case DERBY_SQLTYPE_TIMESTAMP:
+      return TIMESTAMP;
+    case DERBY_SQLTYPE_CLOB:    // large object character SBCS/Mixed
+      return Types.CLOB;
+    case DERBY_SQLTYPE_BLOB:    // large object bytes
+      return java.sql.Types.BLOB;
+    default:
+      return 0;
+    }
+  }
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/UnitOfWorkListener.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/UnitOfWorkListener.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/UnitOfWorkListener.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/UnitOfWorkListener.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,30 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.UnitOfWorkListener
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+public interface UnitOfWorkListener
+{
+  public void listenToUnitOfWork ();
+
+  public void completeLocalCommit (java.util.Iterator listenerIterator);
+
+  public void completeLocalRollback (java.util.Iterator listenerIterator);
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/UnitOfWorkListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,310 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.Utils
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+// Self-contained utilities.
+// Don't reference any other driver classes, except Configuration, from within this class.
+public final class Utils
+{
+
+  static String getStringFromBytes (byte[] bytes)
+  {
+    if (bytes == null) return "{}";
+    StringBuffer stringBuffer = new StringBuffer (bytes.length*6 + 4);
+    stringBuffer.append ("{ ");
+    for (int i=0; i < bytes.length; i++) {
+      stringBuffer.append ("0x");
+      stringBuffer.append (Integer.toHexString (bytes[i] & 0xff));
+      if (i != bytes.length - 1) stringBuffer.append (", ");
+    }
+    stringBuffer.append (" }");
+    return stringBuffer.toString();
+  }
+
+  static String getStringFromInts (int[] ints)
+  {
+    if (ints == null) return "{}";
+    StringBuffer stringBuffer = new StringBuffer ();
+    stringBuffer.append ("{ ");
+    for (int i=0; i < ints.length; i++) {
+      stringBuffer.append (String.valueOf (ints[i]));
+      if (i != ints.length - 1) stringBuffer.append (", ");
+    }
+    stringBuffer.append (" }");
+    return stringBuffer.toString();
+  }
+
+  static String getStringFromStrings (String[] strings)
+  {
+    if (strings == null) return "{}";
+    StringBuffer stringBuffer = new StringBuffer ();
+    stringBuffer.append ("{ ");
+    for (int i=0; i < strings.length; i++) {
+      stringBuffer.append (strings[i]);
+      if (i != strings.length - 1) stringBuffer.append (", ");
+    }
+    stringBuffer.append (" }");
+    return stringBuffer.toString();
+  }
+
+  static public int computeBigDecimalPrecision (java.math.BigDecimal decimal)
+  {
+    byte[] bBytes = decimal.unscaledValue().abs().toByteArray();
+
+    if (byteArrayCmp (bBytes, tenRadixArr[tenRadixArr.length-1]) >= 0)
+      throw new java.lang.IllegalArgumentException ("Precision exceeds 31 digits!");
+
+    int lo=0, hi=tenRadixArr.length-1, mi=(hi+lo)/2;
+    do {
+      int compare = byteArrayCmp (bBytes, tenRadixArr[mi]);
+      if (compare == 1)
+        lo = mi;
+      else if (compare == -1)
+        hi = mi;
+      else
+        break;
+
+      mi = (hi+lo)/2;
+    }
+    while (mi != lo);
+
+    return (mi+1);
+  }
+
+  // Used only by computeBigDecimalPrecision()
+  private static int byteArrayCmp (byte[] arg1, byte[] arg2)
+  {
+    int arg1Offset = 0;
+    int arg2Offset = 0;
+    int length;
+    if (arg1.length > arg2.length) {
+      int diff = arg1.length-arg2.length;
+      for (; arg1Offset<diff; arg1Offset++)
+        if (arg1[arg1Offset] != 0) return 1;
+      length = arg2.length;
+    }
+    else if (arg1.length < arg2.length) {
+      int diff = arg2.length-arg1.length;
+      for (; arg2Offset<diff; arg2Offset++)
+        if (arg2[arg2Offset] != 0) return -1;
+      length = arg1.length;
+    }
+    else {
+      length = arg1.length;
+    }
+
+    for (int i=0; i<length; i++) {
+      int b1 = arg1[arg1Offset+i] & 0xFF;
+      int b2 = arg2[arg2Offset+i] & 0xFF;
+      if (b1 > b2)
+        return 1;
+      else if (b1 < b2)
+          return -1;
+    }
+    return 0;
+  }
+
+  // Used only by computeBigDecimalPrecision()
+  // byte array of 1, 10, 100, 1000, 10000, ..., 10^31 for
+  // fast computing the length a BigDecimal.
+  private static byte[][] tenRadixArr = {
+    { (byte)0x01 }, // 10^0
+    { (byte)0x0A }, // 10^1
+    { (byte)0x64 }, // 10^2
+    { (byte)0x03, (byte)0xe8 }, // 10^3
+    { (byte)0x27, (byte)0x10 }, // 10^4
+    { (byte)0x01, (byte)0x86, (byte)0xa0 }, // 10^5
+    { (byte)0x0f, (byte)0x42, (byte)0x40 }, // 10^6
+    { (byte)0x98, (byte)0x96, (byte)0x80 }, // 10^7
+    { (byte)0x05, (byte)0xf5, (byte)0xe1, (byte)0x00 }, // 10^8
+    { (byte)0x3b, (byte)0x9a, (byte)0xca, (byte)0x00 }, // 10^9
+    { (byte)0x02, (byte)0x54, (byte)0x0b, (byte)0xe4, (byte)0x00 }, // 10^10
+    { (byte)0x17, (byte)0x48, (byte)0x76, (byte)0xe8, (byte)0x00 }, // 10^11
+    { (byte)0xe8, (byte)0xd4, (byte)0xa5, (byte)0x10, (byte)0x00 }, // 10^12
+    { (byte)0x09, (byte)0x18, (byte)0x4e, (byte)0x72, (byte)0xa0, (byte)0x00 }, // 10^13
+    { (byte)0x5a, (byte)0xf3, (byte)0x10, (byte)0x7a, (byte)0x40, (byte)0x00 }, // 10^14
+    { (byte)0x03, (byte)0x8d, (byte)0x7e, (byte)0xa4, (byte)0xc6, (byte)0x80, (byte)0x00 }, // 10^15
+    { (byte)0x23, (byte)0x86, (byte)0xf2, (byte)0x6f, (byte)0xc1, (byte)0x00, (byte)0x00 }, // 10^16
+    { (byte)0x01, (byte)0x63, (byte)0x45, (byte)0x78, (byte)0x5d, (byte)0x8a, (byte)0x00, (byte)0x00 }, // 10^17
+    { (byte)0x0d, (byte)0xe0, (byte)0xb6, (byte)0xb3, (byte)0xa7, (byte)0x64, (byte)0x00, (byte)0x00 }, // 10^18
+    { (byte)0x8a, (byte)0xc7, (byte)0x23, (byte)0x04, (byte)0x89, (byte)0xe8, (byte)0x00, (byte)0x00 }, // 10^19
+    { (byte)0x05, (byte)0x6b, (byte)0xc7, (byte)0x5e, (byte)0x2d, (byte)0x63, (byte)0x10, (byte)0x00, (byte)0x00 }, // 10^20
+    { (byte)0x36, (byte)0x35, (byte)0xc9, (byte)0xad, (byte)0xc5, (byte)0xde, (byte)0xa0, (byte)0x00, (byte)0x00 }, // 10^21
+    { (byte)0x02, (byte)0x1e, (byte)0x19, (byte)0xe0, (byte)0xc9, (byte)0xba, (byte)0xb2, (byte)0x40, (byte)0x00, (byte)0x00 }, // 10^22
+    { (byte)0x15, (byte)0x2d, (byte)0x02, (byte)0xc7, (byte)0xe1, (byte)0x4a, (byte)0xf6, (byte)0x80, (byte)0x00, (byte)0x00 }, // 10^23
+    { (byte)0xd3, (byte)0xc2, (byte)0x1b, (byte)0xce, (byte)0xcc, (byte)0xed, (byte)0xa1, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^24
+    { (byte)0x08, (byte)0x45, (byte)0x95, (byte)0x16, (byte)0x14, (byte)0x01, (byte)0x48, (byte)0x4a, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^25
+    { (byte)0x52, (byte)0xb7, (byte)0xd2, (byte)0xdc, (byte)0xc8, (byte)0x0c, (byte)0xd2, (byte)0xe4, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^26
+    { (byte)0x03, (byte)0x3b, (byte)0x2e, (byte)0x3c, (byte)0x9f, (byte)0xd0, (byte)0x80, (byte)0x3c, (byte)0xe8, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^27
+    { (byte)0x20, (byte)0x4f, (byte)0xce, (byte)0x5e, (byte)0x3e, (byte)0x25, (byte)0x02, (byte)0x61, (byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^28
+    { (byte)0x01, (byte)0x43, (byte)0x1e, (byte)0x0f, (byte)0xae, (byte)0x6d, (byte)0x72, (byte)0x17, (byte)0xca, (byte)0xa0, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^29
+    { (byte)0x0c, (byte)0x9f, (byte)0x2c, (byte)0x9c, (byte)0xd0, (byte)0x46, (byte)0x74, (byte)0xed, (byte)0xea, (byte)0x40, (byte)0x00, (byte)0x00, (byte)0x00 }, // 10^30
+    { (byte)0x7e, (byte)0x37, (byte)0xbe, (byte)0x20, (byte)0x22, (byte)0xc0, (byte)0x91, (byte)0x4b, (byte)0x26, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00 }  // 10^31
+  };
+
+  // If the input string is short, pad it with blanks.
+  // If the input string is long, truncate it.
+  static public String padOrTruncate (String s, int fixedLength)
+  {
+    if (s.length() >= fixedLength) // we need to truncate
+      return s.substring (0, fixedLength);
+    else { // we need to pad
+      StringBuffer buffer = new StringBuffer (s);
+      for (int i = 0; i < fixedLength - s.length(); i++)
+        buffer.append (" ");
+      return buffer.toString();
+    }
+  }
+
+  static public void checkForNegativePositiveSqlcard (Sqlca sqlca, Statement statement) throws SqlException
+  {
+    if (sqlca != null) {
+      int sqlcode = sqlca.getSqlCode ();
+      if (sqlcode < 0) {
+        throw new SqlException (statement.agent_.logWriter_, sqlca);
+      }
+      else {
+        if (sqlcode > 0)
+          statement.accumulateWarning (new SqlWarning (statement.agent_.logWriter_, sqlca));
+      }
+    }
+  }
+
+  static public void checkForNegativePositiveSqlcard (Sqlca sqlca, ResultSet resultSet) throws SqlException
+  {
+    if (sqlca != null) {
+      int sqlcode = sqlca.getSqlCode ();
+      if (sqlcode < 0) {
+        throw new SqlException (resultSet.agent_.logWriter_, sqlca);
+      }
+      else {
+        if (sqlcode > 0)
+          resultSet.accumulateWarning (new SqlWarning (resultSet.agent_.logWriter_, sqlca));
+      }
+    }
+  }
+
+  static public int getSqlcodeFromSqlca (Sqlca sqlca)
+  {
+    if (sqlca == null)
+      return 0;
+    return sqlca.getSqlCode();
+  }
+
+  static public int getUpdateCountFromSqlcard (Sqlca sqlca)
+  {
+    if (sqlca == null)
+      return 0;
+    else
+      return sqlca.getUpdateCount();
+  }
+
+  public static int min (int i, int j)
+  {
+    return (i < j) ? i : j;
+  }
+
+  public static int max (int i, int j)
+  {
+    return (i < j) ? j : i;
+  }
+
+  // latestException is assumed to be non-null, accumulatedExceptions can be null
+  public static SqlException accumulateSQLException (SqlException latestException,
+                                                     SqlException accumulatedExceptions)
+  {
+    if (accumulatedExceptions == null)
+      return latestException;
+    else {
+      accumulatedExceptions.setNextException (latestException);
+      return accumulatedExceptions;
+    }
+  }
+
+  // latestException is assumed to be non-null, accumulatedExceptions can be null
+  public static SqlWarning accumulateSQLWarning (SqlWarning latestException,
+                                                   SqlWarning accumulatedExceptions)
+  {
+    latestException.setNextException (accumulatedExceptions);
+    return latestException;
+  }
+
+  // just a thought...
+  static String getSQLTypeName (int sqlType)
+  {
+    switch (sqlType) {
+    case java.sql.Types.BIGINT:
+      return "BIGINT";
+    case java.sql.Types.BINARY:
+      return "BINARY";
+    case java.sql.Types.BIT:
+      return "BIT";
+    case java.sql.Types.CHAR:
+      return "CHAR";
+    case java.sql.Types.DATE:
+      return "DATE";
+    case java.sql.Types.DECIMAL:
+      return "DECIMAL";
+    case java.sql.Types.DOUBLE:
+      return "DOUBLE";
+    case java.sql.Types.REAL:
+      return "REAL";
+    case java.sql.Types.INTEGER:
+      return "INTEGER";
+    case java.sql.Types.LONGVARBINARY:
+      return "LONGVARBINARY";
+    case java.sql.Types.LONGVARCHAR:
+      return "LONGVARCHAR";
+    case java.sql.Types.NULL:
+      return "NULL";
+    case java.sql.Types.NUMERIC:
+      return "NUMERIC";
+    case java.sql.Types.OTHER:
+      return "OTHER";
+    case java.sql.Types.FLOAT:
+      return "FLOAT";
+    case java.sql.Types.SMALLINT:
+      return "SMALLINT";
+    case java.sql.Types.TIME:
+      return "TIME";
+    case java.sql.Types.TIMESTAMP:
+      return "TIMESTAMP";
+    case java.sql.Types.TINYINT:
+      return "TINYINT";
+    case java.sql.Types.VARBINARY:
+      return "VARBINARY";
+    case java.sql.Types.VARCHAR:
+      return "VARCHAR";
+    default:
+      return null;
+    }
+  }
+
+  public static boolean isSqlTypeNullable (int sqlType)
+  {
+    return (sqlType | 0x01) == sqlType;
+  }
+
+  public static int getNonNullableSqlType (int sqlType)
+  {
+    return sqlType & ~1;
+  }
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Utils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,178 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.Version
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+import org.apache.derby.iapi.services.info.ProductVersionHolder;
+
+public abstract class Version
+{
+  // Same as java.sql.DatabaseMetaData.getDriverName()
+  public static String getDriverName ()
+  { return Configuration.dncDriverName; }
+
+  // for DatabaseMetaData.getDriverVersion()
+  public static String getDriverVersion()
+  {
+	return Configuration.dncProductVersionHolder__.getVersionBuildString(false);
+  }
+
+
+  // Same as java.sql.Driver.getMajorVersion(), getMinorVersion()
+  public static int getMajorVersion()
+  {
+	return Configuration.getProductVersionHolder().getMajorVersion();
+  }
+
+  public static int getMinorVersion()
+  {
+	return Configuration.getProductVersionHolder().getMinorVersion();
+  }
+
+  public static int getBuildNumber()
+  {
+	return Configuration.getProductVersionHolder().getBuildNumberAsInt();
+  }
+
+  public static int getProtocolMaintVersion()
+  {
+	return Configuration.getProductVersionHolder().getDrdaMaintVersion();
+  }
+  
+  public static boolean isAlpha()
+  {
+	return Configuration.getProductVersionHolder().isAlpha();
+  }
+
+  public static boolean isBeta()
+  {
+	return Configuration.getProductVersionHolder().isBeta();
+  }
+
+  // Not an external, just a helper method
+  private  static String getDriverNameAndVersion ()
+  {
+	  return Configuration.dncDriverName + " " + 
+		  Configuration.dncProductVersionHolder__.getVersionBuildString(true);
+  }
+
+  // -------------------------- configuration print stream ---------------------
+
+  public static void writeDriverConfiguration (java.io.PrintWriter printWriter)
+  {
+    String header = "[derby] ";
+    synchronized (printWriter) {
+      printWriter.println (header + "BEGIN TRACE_DRIVER_CONFIGURATION");
+      printWriter.println (header + "Driver: " + getDriverNameAndVersion ());
+
+      printWriter.print (header + "Compatible JRE versions: { ");
+      for (int i=0; i < Configuration.dncCompatibleJREVersions.length; i++) {
+        printWriter.print (Configuration.dncCompatibleJREVersions[i]);
+        if (i != Configuration.dncCompatibleJREVersions.length - 1)
+          printWriter.print (", ");
+      }
+      printWriter.println (" }");
+
+      printWriter.println (header + "Range checking enabled: " + Configuration.rangeCheckCrossConverters);
+      printWriter.println (header + "Bug check level: 0x" + Integer.toHexString (Configuration.bugCheckLevel));
+      printWriter.println (header + "Default fetch size: " + Configuration.defaultFetchSize);
+      printWriter.println (header + "Default isolation: " + Configuration.defaultIsolation);
+
+      java.lang.SecurityManager security = java.lang.System.getSecurityManager ();
+      if (security == null)
+        printWriter.println (header + "No security manager detected.");
+      else
+        printWriter.println (header + "Security manager detected.");
+
+      detectLocalHost (java.lang.System.getSecurityManager (), printWriter);
+
+      printSystemProperty (security, "JDBC 1 system property jdbc.drivers = ", "jdbc.drivers", printWriter);
+
+      printSystemProperty (security, "Java Runtime Environment version ", "java.version", printWriter);
+      printSystemProperty (security, "Java Runtime Environment vendor = ", "java.vendor", printWriter);
+      printSystemProperty (security, "Java vendor URL = ", "java.vendor.url", printWriter);
+      printSystemProperty (security, "Java installation directory = ", "java.home", printWriter);
+      printSystemProperty (security, "Java Virtual Machine specification version = ", "java.vm.specification.version", printWriter);
+      printSystemProperty (security, "Java Virtual Machine specification vendor = ", "java.vm.specification.vendor", printWriter);
+      printSystemProperty (security, "Java Virtual Machine specification name = ", "java.vm.specification.name", printWriter);
+      printSystemProperty (security, "Java Virtual Machine implementation version = ", "java.vm.version", printWriter);
+      printSystemProperty (security, "Java Virtual Machine implementation vendor = ", "java.vm.vendor", printWriter);
+      printSystemProperty (security, "Java Virtual Machine implementation name = ", "java.vm.name", printWriter);
+      printSystemProperty (security, "Java Runtime Environment specification version = ", "java.specification.version", printWriter);
+      printSystemProperty (security, "Java Runtime Environment specification vendor = ", "java.specification.vendor", printWriter);
+      printSystemProperty (security, "Java Runtime Environment specification name = ", "java.specification.name", printWriter);
+      printSystemProperty (security, "Java class format version number = ", "java.class.version", printWriter);
+      printSystemProperty (security, "Java class path = ", "java.class.path", printWriter);
+      printSystemProperty (security, "Java native library path = ", "java.library.path", printWriter);
+      printSystemProperty (security, "Path of extension directory or directories = ", "java.ext.dirs", printWriter);
+      printSystemProperty (security, "Operating system name = ", "os.name", printWriter);
+      printSystemProperty (security, "Operating system architecture = ", "os.arch", printWriter);
+      printSystemProperty (security, "Operating system version = ", "os.version", printWriter);
+      printSystemProperty (security, "File separator (\"/\" on UNIX) = ", "file.separator", printWriter);
+      printSystemProperty (security, "Path separator (\":\" on UNIX) = ", "path.separator", printWriter);
+      printSystemProperty (security, "User's account name = ", "user.name", printWriter);
+      printSystemProperty (security, "User's home directory = ", "user.home", printWriter);
+      printSystemProperty (security, "User's current working directory = ", "user.dir", printWriter);
+      printWriter.println (header + "END TRACE_DRIVER_CONFIGURATION");
+      printWriter.flush();
+    }
+  }
+
+  private static void printSystemProperty (java.lang.SecurityManager security,
+                                    String prefix,
+                                    String property,
+                                    java.io.PrintWriter printWriter)
+  {
+    String header = "[derby] ";
+    synchronized (printWriter) {
+      try {
+        if (security != null)
+          security.checkPropertyAccess (property);
+        String result = System.getProperty (property);
+        printWriter.println (header + prefix + result);
+        printWriter.flush();
+      }
+      catch (SecurityException e) {
+        printWriter.println (header + "Security manager does not permit access to system property " + property);
+        printWriter.flush();
+      }
+    }
+  }
+
+  // printWriter synchronized by caller
+  private static void detectLocalHost (java.lang.SecurityManager security, java.io.PrintWriter printWriter)
+  {
+    String header = "[derby] ";
+    // getLocalHost() will hang the HotJava 1.0 browser with a high security manager.
+    if (security == null) {
+      try {
+        printWriter.print (header + "Detected local client host: ");
+        printWriter.println (java.net.InetAddress.getLocalHost().toString ());
+        printWriter.flush();
+      }
+      catch (java.net.UnknownHostException e) {
+        printWriter.print (header + "Detected an improper TCP/IP client configuration.");
+        printWriter.print (header + "Unable to determine the IP address of your local host: ");
+        printWriter.print (e.getMessage ());
+        printWriter.println (header + "Make sure your client machine has a properly configured IP address.");
+        printWriter.flush();
+      }
+    }
+  }
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/Version.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/XaException.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/am/XaException.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/am/XaException.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/am/XaException.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,116 @@
+/*
+
+   Derby - Class org.apache.derby.client.am.XaException
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.am;
+
+
+public class XaException extends javax.transaction.xa.XAException implements Diagnosable
+{
+  java.lang.Throwable throwable_ = null;
+
+  //-----------------constructors-----------------------------------------------
+
+  public XaException (LogWriter logWriter)
+  {
+    super ();
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public XaException (LogWriter logWriter, java.lang.Throwable throwable)
+  {
+    super ();
+    throwable_ = throwable;
+    if( ((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&
+         (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||
+        (org.apache.derby.client.am.Configuration.jreLevelMajor > 1) )
+    { // jre 1.4 or above, init the cause
+      initCause( throwable );
+    }
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public XaException (LogWriter logWriter, int errcode)
+  {
+    super ();
+    errorCode = errcode;
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public XaException (LogWriter logWriter, java.lang.Throwable throwable, int errcode)
+  {
+    super ();
+    errorCode = errcode;
+    throwable_ = throwable;
+    if( ((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&
+         (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||
+        (org.apache.derby.client.am.Configuration.jreLevelMajor > 1) )
+    { // jre 1.4 or above, init the cause
+      initCause( throwable );
+    }
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public XaException (LogWriter logWriter, String s)
+  {
+    super (s);
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public XaException (LogWriter logWriter, java.lang.Throwable throwable, String s)
+  {
+    super (s);
+    throwable_ = throwable;
+    if( ((org.apache.derby.client.am.Configuration.jreLevelMajor == 1) &&
+         (org.apache.derby.client.am.Configuration.jreLevelMinor >= 4)) ||
+        (org.apache.derby.client.am.Configuration.jreLevelMajor > 1) )
+    { // jre 1.4 or above, init the cause
+      initCause( throwable );
+    }
+    if (logWriter != null) logWriter.traceDiagnosable (this);
+  }
+
+  public Sqlca getSqlca ()
+  {
+    return null;
+  }
+
+  public java.lang.Throwable getThrowable ()
+  {
+    return throwable_;
+  }
+
+  public void printTrace (java.io.PrintWriter printWriter, String header)
+  {
+    ExceptionFormatter.printTrace (this, printWriter, header);
+  }
+
+  // Return a single XaException without the "next" pointing to another SQLException.
+  // Because the "next" is a private field in java.sql.SQLException,
+  // we have to create a new XaException in order to break the chain with "next" as null.
+  XaException copyAsUnchainedXAException (LogWriter logWriter)
+  {
+    XaException xae = new XaException (logWriter, this.getThrowable(), getMessage()); // client error
+    xae.errorCode = this.errorCode;
+    return xae;
+  }
+}
+
+
+

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/am/XaException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CcsidManager.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CcsidManager.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CcsidManager.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CcsidManager.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,93 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.CcsidManager
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+// Performs character conversions as required to send and receive PROTOCOL control data.
+// User data uses the JVM's built in converters, i18n.jar,
+public abstract class CcsidManager
+{
+  public byte space_; // ' ' character
+  byte dot_;   // '.' character
+
+  // Byte array used to convert numbers into
+  // bytes containing the character representation "value" for the particular ccsid.
+  byte[] numToCharRepresentation_;
+
+  // Special byte array to convert first half byte of CRRTKNs TCPIP address and port number
+  // to a character.  This is required for SNA hopping.
+  // This was specifically added to help build the CRRTKNs.
+  byte[] numToSnaRequiredCrrtknChar_;
+
+  CcsidManager (byte space,
+                byte dot,
+                byte[] numToCharRepresentation,
+                byte[] numToSnaRequiredCrrtknChar)
+  {
+    space_ = space;
+    dot_ = dot;
+    numToCharRepresentation_ = numToCharRepresentation;
+    numToSnaRequiredCrrtknChar_ = numToSnaRequiredCrrtknChar;
+  }
+
+
+  // Convert a Java String into bytes for a particular ccsid.
+  //
+  // @param sourceString A Java String to convert.
+  // @return A new byte array representing the String in a particular ccsid.
+  public abstract byte[] convertFromUCS2 (String sourceString, org.apache.derby.client.am.Agent agent) throws org.apache.derby.client.am.SqlException;
+
+
+  // Convert a Java String into bytes for a particular ccsid.
+  // The String is converted into a buffer provided by the caller.
+  //
+  // @param sourceString  A Java String to convert.
+  // @param buffer        The buffer to convert the String into.
+  // @param offset        Offset in buffer to start putting output.
+  // @return An int containing the buffer offset after conversion.
+  public abstract int convertFromUCS2 (String sourceString,
+                                byte[] buffer,
+                                int offset,
+                                org.apache.derby.client.am.Agent agent) throws org.apache.derby.client.am.SqlException;
+
+  // Convert a byte array representing characters in a particular ccsid into a Java String.
+  //
+  // @param sourceBytes An array of bytes to be converted.
+  // @return String A new Java String Object created after conversion.
+  abstract String convertToUCS2 (byte[] sourceBytes);
+
+
+  // Convert a byte array representing characters in a particular ccsid into a Java String.
+  //
+  // @param sourceBytes An array of bytes to be converted.
+  // @param offset  An offset indicating first byte to convert.
+  // @param numToConvert The number of bytes to be converted.
+  // @return A new Java String Object created after conversion.
+  abstract String convertToUCS2 (byte[] sourceBytes, int offset, int numToConvert);
+
+
+  // Convert a byte representing a char in a particular ccsid into a Java char.
+  //
+  // @param sourceByte The byte to be converted
+  // @return The converted Java char.
+  abstract char convertToUCS2Char (byte sourceByte);
+
+}
+

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CcsidManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,726 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.CodePoint
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+
+public class CodePoint
+{
+  public static final int FIXED_ROW_QUERY_PROTOCOL = 0;
+  public static final int LIMITED_BLOCK_QUERY_PROTOCOL = 1;
+  public static final int FORCE_FIXED_ROW_QUERY_PROTOCOL = 2;
+
+
+  // Character Subtype MBCS
+  static final int CSTMBCS = 0x2435;
+
+
+  // Force Fixed Row Query Protocol
+  static final int FRCFIXROW = 0x2410;
+
+  // Title
+  static final int TITLE = 0x0045;
+
+  // ---------------callable statement codepoints-------------------------------
+
+  // PKGSNLST
+  static final int PKGSNLST = 0x2139;
+
+  // Output Expected
+  static final int OUTEXP = 0x2111;
+
+  // Procedure Name
+  static final int PRCNAM = 0x2138;
+
+  // Maximum Result Set Count.
+  static final int MAXRSLCNT = 0x2140;
+
+  // Maximum Result Set Count No Limit.
+  // Requester is capable of receiving all result sets in the response to EXCSQLSTT.
+  static final int MAXRSLCNT_NOLIMIT = 0xffff;
+
+  // Result Set Flags
+  static final int RSLSETFLG = 0x2142;
+
+  static final int RSLSETFLG_RETURN_NAMES = 0x80;
+
+  static final int RSLSETFLG_RETURN_LABELS = 0x40;
+
+  // RSLSETFLGs added in SQLAM 7 for requesting standard, extended, or light sqldas
+  static final int RSLSETFLG_STANDARD_SQLDA = 0x00;
+  static final int RSLSETFLG_EXTENDED_SQLDA = 0x04;
+
+  // --------------------code points for constant ddm data----------------------
+
+  // Indicates false state.  This 1-byte code point is used by some DDM parameters.
+  static final byte FALSE = -16;  // was 0xf0
+
+  // Indicates true state.  This 1-byte code point is used by some DDM parameters.
+  static final byte TRUE = -15;  // was 0xf1
+
+  // Zero indicator constant.
+  // Indicates data does flow.
+  static final int ZEROIND = 0x00;
+
+  // FDOCA NULL indicator constant.
+  // Indicates data does not flow.
+  static final int NULLDATA = 0xFF;
+
+  // Security check was successful.
+  static final int SECCHKCD_00 = 0x00;
+
+  // SECMEC value not supported.
+  static final int SECCHKCD_01 = 0x01;
+
+  // Local security service info.
+  static final int SECCHKCD_08 = 0x08;
+
+  // Local security service retryable error.
+  static final int SECCHKCD_09 = 0x09;
+
+  // Local security service non-retryable error.
+  static final int SECCHKCD_0A = 0x0A;
+
+  // SECTKN missing or invalid.
+  static final int SECCHKCD_0B = 0x0B;
+
+  // Password expired.
+  static final int SECCHKCD_0E = 0x0E;
+
+  // Password invalid.
+  static final int SECCHKCD_0F = 0x0F;
+
+  // Password missing.
+  static final int SECCHKCD_10 = 0x10;
+
+  // Userid missing.
+  static final int SECCHKCD_12 = 0x12;
+
+  // Userid invalid.
+  static final int SECCHKCD_13 = 0x13;
+
+  // Userid revoked.
+  static final int SECCHKCD_14 = 0x14;
+
+  // New password invalid.
+  static final int SECCHKCD_15 = 0x15;
+
+  //-----------------------ddm enumerated values-------------------------------
+
+  // TYPSQLDA - Standard Output SQLDA
+  static final int TYPSQLDA_STD_OUTPUT = 0;
+
+  // TYPSQLDA - Standard Input SQLDA
+  static final int TYPSQLDA_STD_INPUT = 1;
+
+  // TYPSQLDA - Light Output SQLDA
+  static final int TYPSQLDA_LIGHT_OUTPUT = 2;
+
+  // TYPSQLDA - Light Input SQLDA
+  static final int TYPSQLDA_LIGHT_INPUT = 3;
+
+  // TYPSQLDA - Extended Output SQLDA
+  static final int TYPSQLDA_X_OUTPUT = 4;
+
+  // TYPSQLDA - Extended Input SQLDA
+  static final int TYPSQLDA_X_INPUT = 5;
+
+  // QRYCLSIMP - Target Server determines whether to implicitly
+  // close the cursor or not upon SQLSTATE 02000 based on cursor type.
+  static final int QRYCLSIMP_SERVER_CHOICE = 0x00;
+
+  // QRYCLSIMP - Target Server must implicitly close the cursor
+  // upon SQLSTATE 02000.
+  static final int QRYCLSIMP_YES = 0x01;
+
+  // QRYCLSIMP - Target Server must not implicitly close the cursor
+  // upon SQLSTATE 02000.
+  static final int QRYCLSIMP_NO = 0x02;
+
+  // ----------------------ddm code points--------------------------------------
+
+  // Exchange Server Attributes.
+  final static int EXCSAT = 0x1041;
+
+
+  // Sync Point Control Request.
+  public final static int SYNCCTL = 0x1055;
+
+  // Sync Point Resync Command.
+  final static int SYNCRSY = 0x1069;
+
+  // Access Security.
+  final static int ACCSEC = 0x106D;
+
+  // Security Check.
+  final static int SECCHK = 0x106E;
+
+  // Access RDB.
+  final static int ACCRDB = 0x2001;
+
+  // Close Query.
+  final static int CLSQRY = 0x2005;
+
+  // Continue Query.
+  final static int CNTQRY = 0x2006;
+
+
+  // Describe SQL Statement.
+  final static int DSCSQLSTT = 0x2008;
+
+
+  // Execute Immediate SQL Statement.
+  final static int EXCSQLIMM = 0x200A;
+
+  // Execute SQL Statement.
+  final static int EXCSQLSTT = 0x200B;
+
+  // Set SQL Environment.
+  final static int EXCSQLSET = 0x2014;
+
+  // Open Query.
+  final static int OPNQRY = 0x200C;
+
+  // Output override.
+  final static int OUTOVR = 0x2415;
+
+  // Prepare SQL Statement.
+  final static int PRPSQLSTT = 0x200D;
+
+  // RDB Commit Unit of Work.
+  final static int RDBCMM = 0x200E;
+
+  // RDB Rollback Unit of Work.
+  final static int RDBRLLBCK = 0x200F;
+
+
+  // Describe RDB Table.
+  final static int DSCRDBTBL = 0x2012;
+
+  // SQL Program Variable Data.
+  final static int SQLDTA = 0x2412;
+
+  // SQL Data Reply Data.
+  public final static int SQLDTARD = 0x2413;
+
+  // SQL Statement.
+  final static int SQLSTT = 0x2414;
+
+
+  // Query Answer Set Description.
+  public final static int QRYDSC = 0x241A;
+
+  // Query Answer Set Data.
+  public final static int QRYDTA = 0x241B;
+
+  // SQL Statement Attributes.
+  final static int SQLATTR = 0x2450;
+
+  // Access Security Reply Data.
+  // Contains the security information from a target server's
+  // security manager.  This information is returned in response
+  // to an ACCSEC command.
+  static final int ACCSECRD = 0x14AC;
+
+
+  // Agent codepoint constant.
+  static final int AGENT = 0x1403;
+
+  // The codepoint for codepoint
+  static final int CODPNT = 0x000C;
+
+  // CCSID for Double-Byte Characters codepoint constant.
+  static final int CCSIDDBC = 0x119D;
+
+  // CCSID for Mixed-Byte Characters codepoint constant.
+  static final int CCSIDMBC = 0x119E;
+  
+
+  // CCSID for Single-Byte Characters codepoint constant.
+  static final int CCSIDSBC = 0x119C;
+
+  // Describes the communications manager that supports
+  // conversational protocols by using System Network
+  // Architecture Logical Unit 6.2 (SNA LU 6.2) local
+  // communications facilities.
+  static final int CMNAPPC = 0x1444;
+
+  // TCP/IP Communication Manager codepoint constant.  Min. level 5.
+  static final int CMNTCPIP = 0x1474;
+
+  // Correlation Token codepoint constant.
+  static final int CRRTKN = 0x2135;
+
+  // Description Error code
+  static final int DSCERRCD = 0x2101;
+
+  // Server Attributes Reply Data codepoint constant.
+  static final int EXCSATRD = 0x1443;
+
+  // External Name codepoint constant.
+  static final int EXTNAM = 0x115E;
+
+  // Fixed Row Query Protocol.
+  static final int FIXROWPRC = 0x2418;
+
+  // Limited Block Query Protocol.
+  static final int LMTBLKPRC = 0x2417;
+
+  // Maximum Number of Extra Blocks.
+  static final int MAXBLKEXT = 0x2141;
+
+  // Manager Level List codepoint constant.
+  static final int MGRLVLLS = 0x1404;
+
+  // Manager Level Number Attribute constants.
+  // Specifies the level of a defined DDM manager.
+  static final int MGRLVLN = 0x1473;
+
+  // Password
+  static final int PASSWORD = 0x11A1;
+
+  // Package name & consistency token
+  static final int PKGNAMCT = 0x2112;
+
+  // Conversational Protocol Error Code
+  static final int PRCCNVCD = 0x113F;
+
+  // Product Specific Identifier codepoint constant.
+  static final int PRDID = 0x112E;
+
+  // Product Specific Data
+  static final int PRDDTA = 0x2104;
+
+  // Query Attribute for Scrollability.
+  static final int QRYATTSCR = 0x2149;
+
+  // Query Attribute for Rowset
+  static final int QRYATTSET = 0x214A;
+
+  // Query Attribute for Sensitivity.
+  static final int QRYATTSNS = 0x2157;
+
+  // Query Attribute for Updatability.
+  static final int QRYATTUPD = 0x2150;
+
+  // Query Close Implicit
+  static final int QRYCLSIMP = 0x215D;
+
+  // Query Scroll Orientation.
+  static final int QRYSCRORN = 0x2152;
+
+  // Query Scroll Relative Orientation.
+  static final int QRYSCRREL = 1;
+
+  // Query Scroll Absolute Orientation.
+  static final int QRYSCRABS = 2;
+
+  // Query Scroll After Orientation.
+  static final int QRYSCRAFT = 3;
+
+  // Query Scroll Before Orientation.
+  static final int QRYSCRBEF = 4;
+
+  // Query Instance Identifier
+  static final int QRYINSID = 0x215B;
+
+  // Query Insensitive to Changes
+  static final int QRYINS = 1;
+
+  // Query Attributes is Unknown or Undefined
+  static final int QRYUNK = 0;
+
+  // Query Row Number.
+  static final int QRYROWNBR = 0x213D;
+
+  // Query Block Reset.
+  static final int QRYBLKRST = 0x2154;
+
+  // Query Returns Data.
+  static final int QRYRTNDTA = 0x2155;
+
+  // Query Block Protocol Control
+  static final int QRYBLKCTL = 0x2132;
+
+  // Query Block Size
+  static final int QRYBLKSZ = 0x2114;
+
+  // Query Protocol Type
+  static final int QRYPRCTYP = 0x2102;
+
+  // Query Rowset Size.
+  static final int QRYROWSET = 0x2156;
+
+  // Cursor is Read-only.
+  static final int QRYRDO = 0x1;
+
+  // Cursor Allows Read, Delete, and Update Operations.
+  static final int QRYUPD = 0x4;
+
+  // Relational Database codepoint constant.  Min. level 3.
+  static final int RDB = 0x240F;
+
+  // RDB Access Manager Class.
+  static final int RDBACCCL = 0x210F;
+
+  // RDB Allow Updates
+  static final int RDBALWUPD = 0x211A;
+
+  // Relational Database Name codepoint constant.
+  static final int RDBNAM = 0x2110;
+
+
+  // Resynchronization Manager.  Min levl 5.
+  // It is a manager object of DDM that performs
+  // resynchronization for in-doubt units of work after
+  // a sync point operation failure.
+  static final int RSYNCMGR = 0x14C1;
+
+  // Retuan SQL Descriptor Area
+  static final int RTNSQLDA = 0x2116;
+
+
+  // Type of SQL Descriptor Area
+  static final int TYPSQLDA = 0x2146;
+
+  // Security Check Code codepoint constant.
+  static final int SECCHKCD = 0x11A4;
+
+  // Security Mechanism codepoint constant.
+  static final int SECMEC = 0x11A2;
+
+  // Security Manager codepoint constant.
+  static final int SECMGR = 0x1440;
+
+  // Security Token codepoint constant.
+  static final int SECTKN = 0x11DC;
+
+  // SQL Application Manager codepoint constant.  Min. level 3.
+  static final int SQLAM = 0x2407;
+
+  // SQL Communication Area Reply Data codepoint constant.
+  public static final int SQLCARD = 0x2408;
+
+  // SQL Result Set Column Information Reply Data.
+  public static final int SQLCINRD = 0x240B;
+
+  // Hold Cursor Position
+  static final int SQLCSRHLD = 0x211F;
+
+  // SQL Result Set Reply Data.
+  static final int SQLRSLRD = 0x240E;
+
+  // SQLDA Reply Data codepoint constant.
+  public static final int SQLDARD = 0x2411;
+
+  // Server Class Name codepoint constant.
+  static final int SRVCLSNM = 0x1147;
+
+  
+  // Server Name codepoint constant.
+  static final int SRVNAM = 0x116D;
+
+  // Server Product Release Level codepoint constant.
+  static final int SRVRLSLV = 0x115A;
+
+  // Severity Code codepoint constant.
+  static final int SVRCOD = 0x1149;
+
+  // Sync Point Manager.  Min. level 4.
+  // It is a manager object of DDM that coordinates resource
+  // recovery of the units of work associated with recoverable
+  // resources in multiple DDM servers.
+  static final int SYNCPTMGR = 0x14C0;
+
+  // Syntax Error code
+  static final int SYNERRCD = 0x114A;
+
+  // Data Type Definition Name codepoint constant.
+  public static final int TYPDEFNAM = 0x002F;
+
+  // TYPDEF Overrides codepoint constant.
+  public static final int TYPDEFOVR = 0x0035;
+
+  // Unit of Work Disposition codepoint constant.
+  static final int UOWDSP = 0x2115;
+
+  // Unit of Work Disposition.  Committed Enumerated Value.
+  static final int UOWDSP_COMMIT = 0x01;
+
+  // Unit of Work Dispostion. Rolled Back Enumerated Value.
+  static final int UOWDSP_ROLLBACK = 0x02;
+
+  // Usrid codepoint constant.
+  static final int USRID = 0x11A0;
+
+  // Rdb Package Name, Consistency Token, and Section
+  // Number codepoint constant.
+  static final int PKGNAMCSN = 0x2113;
+
+  // RDB Package Section Number
+  static final int PKGSN = 0x210C;
+
+  // Scalar Data Length
+  static final int SCLDTALEN = 0x0100;
+
+  // XA Manager
+  static final int XAMGR = 0x1C01;
+
+  //-----------------------DDM reply codepoints---------------------------------
+
+  // Command Check codepoint constant.
+  public static final int CMDCHKRM = 0x1254;
+
+  // Command Not Supported codepoint constant.
+  static final int CMDNSPRM = 0x1250;
+
+  // Abnormal End of Unit of Work Condition codepoint constant.
+  static final int ABNUOWRM = 0x220D;
+
+  // Access to RDB Completed.
+  // Specifies that an instance of the SQL application manager
+  // has been created and is bound to the specified RDB.
+  static final int ACCRDBRM = 0x2201;
+
+
+  final static int MGRLVLRM = 0x1210;
+
+  // End Unit of Work Condition codepoint constant.
+  static final int ENDUOWRM = 0x220C;
+
+  // Object Not Supported codepoint constant.
+  static final int OBJNSPRM = 0x1253;
+
+  // Conversational Protocol Error
+  public static final int PRCCNVRM = 0x1245;
+
+  // Query not open codepoint constant.
+  static final int QRYNOPRM = 0x2202;
+
+  // Query previously opened codepoint
+  static final int QRYPOPRM = 0x220F;
+
+  // RDB Currently Accessed Codepoint
+  static final int RDBACCRM = 0x2207;
+
+  // RDB Commit Allowed codepoint
+  static final int RDBCMTOK = 0x2105;
+
+  // Security Check.
+  // Indicates the acceptability of the security information.
+  static final int SECCHKRM = 0x1219;
+
+  // RDB Access Failed Reply Message codepoint
+  static final int RDBAFLRM = 0x221A;
+
+  // Not Authorized To RDB reply message codepoint
+  static final int RDBATHRM = 0x22CB;
+
+  // RDB Not Accessed codepoint constant.
+  static final int RDBNACRM = 0x2204;
+
+  // RDB not found codepoint
+  static final int RDBNFNRM = 0x2211;
+
+  // RDB Update Reply Message codepoint constant.
+  static final int RDBUPDRM = 0x2218;
+
+  // Data Stream Syntax Error
+  public static final int SYNTAXRM = 0x124C;
+
+  // Parameter Value Not Supported codepoint constant.
+  public static final int VALNSPRM = 0x1252;
+
+  // SQL Error Condition codepoint constant.
+  static final int SQLERRRM = 0x2213;
+
+  // Open Query Complete.
+  public final static int OPNQRYRM = 0x2205;
+
+  // End of Query.
+  public final static int ENDQRYRM = 0x220B;
+
+  // Data Descriptor Mismatch.
+  final static int DTAMCHRM = 0x220E;
+
+  // Open Query Failure.
+  final static int OPNQFLRM = 0x2212;
+
+  // RDB Result Set Reply Message.
+  public final static int RSLSETRM = 0x2219;
+
+  // Manager Level Overrides
+  public static final int MGRLVLOVR = 0x1C03;
+  
+  //----------------------------fdoca code points-------------------------------
+
+  static final int RTNEXTDTA = 0x2148;
+  static final int RTNEXTROW = 0x01;
+  static final int RTNEXTALL = 0x02;
+
+  // Externalized FD:OCA Data codepoint constant.
+  public static final int EXTDTA = 0x146C;
+
+  // FDOCA data descriptor
+  static final int FDODSC = 0x0010;
+
+  // FDOCA data
+  static final int FDODTA = 0x147A;
+
+  //--------------------------ddm error code points---------------------------------
+  // Syntax Error Code.  DSS header length less than 6.
+  static int SYNERRCD_DSS_LESS_THAN_6 = 0x01;
+
+  // Syntax Error Code.  DSS header length does not match the number of
+  // bytes of data found.
+  static int SYNERRCD_DSS_LENGTH_BYTE_NUMBER_MISMATCH = 0x02;
+
+  // Syntax Error Code.  DSS header C-byte not D0.
+  static int SYNERRCD_CBYTE_NOT_D0 = 0x03;
+
+  // Syntax Error Code.  DSS header f-bytes either not recognized or not supported.
+  static int SYNERRCD_FBYTE_NOT_SUPPORTED = 0x04;
+
+  // Syntax Error Code.  Object length less than four.
+  static int SYNERRCD_OBJ_LEN_LESS_THAN_4 = 0x07;
+
+  // Syntax Error Code.  Object length not allowed.
+  static int SYNERRCD_OBJ_LEN_NOT_ALLOWED = 0x0B;
+
+  // Syntax Error Code.  Required object not found.
+  static int SYNERRCD_REQ_OBJ_NOT_FOUND = 0x0E;
+
+  // Syntax Error Code.  Duplicate object present.
+  static int SYNERRCD_DUP_OBJ_PRESENT = 0x12;
+
+  // Syntax Error Code.  Invalid request correlator specified.
+  static int SYNERRCD_INVALID_CORRELATOR = 0x13;
+
+  // Syntax Error Code.  Incorrect large object extended length field.
+  static int SYNERRCD_INCORRECT_EXTENDED_LEN = 0x0C;
+
+  // Syntax Error Code.  DSS continuation less than or equal to two.
+  static int SYNERRCD_DSS_CONT_LESS_OR_EQUAL_2 = 0x16;
+
+  // Syntax Error Code.  DSS chaining bit not b'1', but DSSFMT bit3 set to b'1'.
+  static int SYNERRCD_CHAIN_OFF_SAME_NEXT_CORRELATOR = 0x18;
+
+  // Syntax Error Code.  DSS chaining bit not b'1', but error continuation requested.
+  static int SYNERRCD_CHAIN_OFF_ERROR_CONTINUE = 0x1A;
+
+  // Conversational Protocol Error Code.  OBJDSS sent when not allowed.
+  static int PRCCNVCD_OBJDSS_SENT_NOT_ALLOWED = 0x03;
+
+  // Information Only Severity Code.
+  static int SVRCOD_INFO = 0;
+
+  // Warning Severity Code.
+  static int SVRCOD_WARNING = 4;
+
+  // Error Severity Code.
+  static int SVRCOD_ERROR = 8;
+
+  // Severe Error Severity Code.
+  static int SVRCOD_SEVERE = 16;
+
+  // Access Damage Severity Code.
+  static int SVRCOD_ACCDMG = 32;
+
+  // Permanent Damage Severity Code.
+  static int SVRCOD_PRMDMG = 64;
+
+  // Session Damage Severity Code.
+  static int SVRCOD_SESDMG = 128;
+
+
+  //--------------------------XA code points---------------------------
+
+  // SYNC Point Control Reply
+  public static final int SYNCCRD = 0x1248;
+
+  // XA Return Value
+  public static final int XARETVAL = 0x1904;
+
+  // new unit of work for XA
+  public static final int SYNCTYPE_NEW_UOW = 0x09;
+
+  // End unit of work (Sync type).
+  public static final int SYNCTYPE_END_UOW = 0x0B;
+
+  // Prepare to commit (Sync type).
+  public static final int SYNCTYPE_PREPARE = 0x01;
+
+  // migrate to resync server sync type
+  public static final int SYNCTYPE_MIGRATE = 0x02;
+
+  // commit sync type
+  public static final int SYNCTYPE_COMMITTED = 0x03;
+
+  // request to forget sync type
+  public static final int SYNCTYPE_REQ_FORGET = 0x06;
+
+  //rollback sync type
+  public static final int SYNCTYPE_ROLLBACK = 0x04;
+
+
+  // migrated unit of work sync type
+  public static final int SYNCTYPE_MIGRATED = 0x0A;
+
+  //recover sync type
+  public static final int SYNCTYPE_INDOUBT = 0x0C;
+
+  // Length Codepoint
+  public static final int LLCP = 0x0004;
+
+  // SYNC Type Codepoint
+  public static final int SYNCTYPE = 0x1187;
+
+  // XId Codepoint
+  public static final int XID = 0x1801;
+
+  // XA Flag Codepoint
+  public static final int XAFLAGS = 0x1903;
+
+
+  // Resync Types
+  public static final int RSYNC_FORGET = 0x02;
+
+  // UOW States
+  public static final int RESET_STATE = 0x01;
+  public static final int UNKNOWN_STATE = 0x3;
+  public static final int INDOUBT_STATE = 0x04;
+  public static final int COLD_STATE = 0x05;
+
+  // XA Flags
+  public static final int TMNOFLAGS = 0x00000000;
+  public static final int TMLOCAL = 0x10000000;
+
+  // Prepared and hueristic complete list
+  static final int PRPHRCLST = 0x1905;
+
+  // XID count
+  static final int XIDCNT = 0x1906;
+
+
+  // hide the default constructor
+  private CodePoint () {}
+}
+
+

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePointNameTable.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePointNameTable.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePointNameTable.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePointNameTable.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,93 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.CodePointNameTable
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+// This mapping is used by DssTrace only.
+// This is not part of the driver and is not initialized unless dss tracing is enabled.
+// This is an abstract mapping from 2-byte code point to a string representing the name of the code point.
+// This data type may be modified for performance to adapt to any sort of lookup implementation,
+// such as binary search on an underlying sorted array.
+class CodePointNameTable extends java.util.Hashtable
+{
+  CodePointNameTable ()
+  {
+    put (new Integer (CodePoint.ACCSECRD), "ACCSECRD");
+    put (new Integer (CodePoint.TYPDEFNAM), "TYPDEFNAM");
+    put (new Integer (CodePoint.TYPDEFOVR), "TYPDEFOVR");
+    put (new Integer (CodePoint.EXCSAT), "EXCSAT");
+    put (new Integer (CodePoint.SYNCCTL), "SYNCCTL");
+    put (new Integer (CodePoint.SYNCCRD), "SYNCCRD");
+    put (new Integer (CodePoint.SYNCRSY), "SYNCRSY");
+    put (new Integer (CodePoint.ACCSEC), "ACCSEC");
+    put (new Integer (CodePoint.SECCHK), "SECCHK");
+    put (new Integer (CodePoint.MGRLVLRM), "MGRLVLRM");
+    put (new Integer (CodePoint.SECCHKRM), "SECCHKRM");
+    put (new Integer (CodePoint.CMDNSPRM), "CMDNSPRM");
+    put (new Integer (CodePoint.OBJNSPRM), "OBJNSPRM");
+    put (new Integer (CodePoint.CMDCHKRM), "CMDCHKRM");
+    put (new Integer (CodePoint.SYNTAXRM), "SYNTAXRM");
+    put (new Integer (CodePoint.VALNSPRM), "VALNSPRM");
+    put (new Integer (CodePoint.EXCSATRD), "EXCSATRD");
+    put (new Integer (CodePoint.ACCRDB), "ACCRDB");
+    put (new Integer (CodePoint.CLSQRY), "CLSQRY");
+    put (new Integer (CodePoint.CNTQRY), "CNTQRY");
+    put (new Integer (CodePoint.DSCSQLSTT), "DSCSQLSTT");
+    put (new Integer (CodePoint.EXCSQLIMM), "EXCSQLIMM");
+    put (new Integer (CodePoint.EXCSQLSTT), "EXCSQLSTT");
+    put (new Integer (CodePoint.OPNQRY), "OPNQRY");
+    put (new Integer (CodePoint.PRPSQLSTT), "PRPSQLSTT");
+    put (new Integer (CodePoint.RDBCMM), "RDBCMM");
+    put (new Integer (CodePoint.RDBRLLBCK), "RDBRLLBCK");
+    put (new Integer (CodePoint.DSCRDBTBL), "DSCRDBTBL");
+    put (new Integer (CodePoint.ACCRDBRM), "ACCRDBRM");
+    put (new Integer (CodePoint.QRYNOPRM), "QRYNOPRM");
+    put (new Integer (CodePoint.RDBATHRM), "RDBATHRM");
+    put (new Integer (CodePoint.RDBNACRM), "RDBNACRM");
+    put (new Integer (CodePoint.OPNQRYRM), "OPNQRYRM");
+    put (new Integer (CodePoint.RDBACCRM), "RDBACCRM");
+    put (new Integer (CodePoint.ENDQRYRM), "ENDQRYRM");
+    put (new Integer (CodePoint.ENDUOWRM), "ENDUOWRM");
+    put (new Integer (CodePoint.ABNUOWRM), "ABNUOWRM");
+    put (new Integer (CodePoint.DTAMCHRM), "DTAMCHRM");
+    put (new Integer (CodePoint.QRYPOPRM), "QRYPOPRM");
+    put (new Integer (CodePoint.RDBNFNRM), "RDBNFNRM");
+    put (new Integer (CodePoint.OPNQFLRM), "OPNQFLRM");
+    put (new Integer (CodePoint.SQLERRRM), "SQLERRRM");
+    put (new Integer (CodePoint.RDBUPDRM), "RDBUPDRM");
+    put (new Integer (CodePoint.RSLSETRM), "RSLSETRM");
+    put (new Integer (CodePoint.RDBAFLRM), "RDBAFLRM");
+    put (new Integer (CodePoint.SQLCARD), "SQLCARD");
+    put (new Integer (CodePoint.SQLDARD), "SQLDARD");
+    put (new Integer (CodePoint.SQLDTA), "SQLDTA");
+    put (new Integer (CodePoint.SQLDTARD), "SQLDTARD");
+    put (new Integer (CodePoint.SQLSTT), "SQLSTT");
+    put (new Integer (CodePoint.QRYDSC), "QRYDSC");
+    put (new Integer (CodePoint.QRYDTA), "QRYDTA");
+    put (new Integer (CodePoint.PRCCNVRM), "PRCCNVRM");
+    put (new Integer (CodePoint.EXCSQLSET), "EXCSQLSET");
+    put (new Integer (CodePoint.EXTDTA), "EXTDTA");
+  }
+
+  String lookup (int codePoint)
+  {
+    return (String) get (new Integer (codePoint));
+  }
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/CodePointNameTable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReply.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReply.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReply.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReply.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,73 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.ConnectionReply
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+import org.apache.derby.client.am.ConnectionCallbackInterface;
+import org.apache.derby.client.am.SqlException;
+
+
+public class ConnectionReply
+{
+  private ConnectionReplyInterface materialConnectionReply_;
+  org.apache.derby.client.am.Agent agent_;
+
+  ConnectionReply (org.apache.derby.client.am.Agent agent, ConnectionReplyInterface materialConnectionReply)
+  {
+    agent_ = agent;
+    materialConnectionReply_ = materialConnectionReply;
+  }
+
+  public void readCommitSubstitute (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readCommitSubstitute(connection);
+    agent_.checkForChainBreakingException_();
+  }
+
+  public void readLocalCommit (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readLocalCommit(connection);
+    agent_.checkForChainBreakingException_();
+  }
+
+  public void readLocalRollback (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readLocalRollback(connection);
+    agent_.checkForChainBreakingException_();
+  }
+
+  public void readLocalXAStart (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readLocalXAStart(connection);
+    agent_.checkForChainBreakingException_();
+  }
+
+  public void readLocalXACommit (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readLocalXACommit(connection);
+    agent_.checkForChainBreakingException_();
+  }
+
+  public void readLocalXARollback (ConnectionCallbackInterface connection) throws SqlException
+  {
+    materialConnectionReply_.readLocalXARollback(connection);
+    agent_.checkForChainBreakingException_();
+  }
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReply.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReplyInterface.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReplyInterface.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReplyInterface.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReplyInterface.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,34 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.ConnectionReplyInterface
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+import org.apache.derby.client.am.ConnectionCallbackInterface;
+import org.apache.derby.client.am.DisconnectException;
+
+public interface ConnectionReplyInterface
+{
+  public void readCommitSubstitute (ConnectionCallbackInterface connection) throws DisconnectException;
+  public void readLocalCommit (ConnectionCallbackInterface connection) throws DisconnectException;
+  public void readLocalRollback (ConnectionCallbackInterface connection) throws DisconnectException;
+  public void readLocalXAStart (ConnectionCallbackInterface connection) throws DisconnectException;
+  public void readLocalXACommit (ConnectionCallbackInterface connection) throws DisconnectException;
+  public void readLocalXARollback (ConnectionCallbackInterface connection) throws DisconnectException;
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionReplyInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionRequestInterface.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionRequestInterface.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionRequestInterface.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionRequestInterface.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,35 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.ConnectionRequestInterface
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+// In general, required data is passed.
+// In addition, Connection objects are passed for convenient access to any material connection caches.
+// Implementations of this interface should not dereference common layer Connection state, as it is passed in,
+// but may dereference material layer Connection state if necessary for performance.
+public interface ConnectionRequestInterface
+{
+  public void writeCommitSubstitute (NetConnection connection) throws org.apache.derby.client.am.SqlException;
+  public void writeLocalCommit (NetConnection connection) throws org.apache.derby.client.am.SqlException;
+  public void writeLocalRollback (NetConnection connection) throws org.apache.derby.client.am.SqlException;
+  public void writeLocalXAStart(NetConnection connection) throws org.apache.derby.client.am.SqlException;
+  public void writeLocalXACommit (NetConnection connection) throws org.apache.derby.client.am.SqlException;
+  public void writeLocalXARollback (NetConnection connection) throws org.apache.derby.client.am.SqlException;
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/ConnectionRequestInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/DssConstants.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/DssConstants.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/DssConstants.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/DssConstants.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,69 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.DssConstants
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+class DssConstants
+{
+  static final int MAX_DSS_LEN = 32767;
+
+  // Registered SNA GDS identifier indicating DDM data (xD0 for DDM data).
+  static final int GDS_ID = 0xD0;
+
+  // GDS chaining bits.
+  static final int GDSCHAIN = 0x40;
+
+  // GDS chaining bits where next DSS has different correlation ID.
+  static final int GDSCHAIN_SAME_ID = 0x10;
+
+  // GDS formatter for an Encrypted OBJDSS.
+  static final int GDSFMT_ENCOBJDSS = 0x04;
+
+  // GDS formatter for an OBJDSS.
+  static final int GDSFMT_OBJDSS = 0x03;
+
+  // GDS formatter for an RPYDSS.
+  static final int GDSFMT_RPYDSS = 0x02;
+
+  // GDS formatter for an RQSDSS.
+  static final int GDSFMT_RQSDSS = 0x01;
+
+
+
+  // GDS formatter for an RQSDSS without a reply.
+  static final int GDSFMT_RQSDSS_NOREPLY = 0x05;
+
+  static final byte RQST_CHN_DIFFCOR_CONT = (byte) 0x61;
+  static final byte RQST_CHN_DIFFCOR_NOCONT = (byte) 0x41;
+  static final byte RQST_CHN_SAMECOR_CONT = (byte) 0x71;
+  static final byte RQST_CHN_SAMECOR_NOCONT = (byte) 0x51;
+  static final byte RQST_NOCHN_CONT = (byte) 0x21;
+  static final byte RQST_NOCHN_NOCONT = (byte) 0x01;
+
+  static final byte RPY_CHN_DIFFCOR_CONT = (byte) 0x62;
+  static final byte RPY_CHN_DIFFCOR_NOCONT = (byte) 0x42;
+  static final byte RPY_CHN_SAMECOR_CONT = (byte) 0x72;
+  static final byte RPY_CHN_SAMECOR_NOCONT = (byte) 0x52;
+  static final byte RPY_NOCHN_CONT = (byte) 0x22;
+  static final byte RPY_NOCHN_NOCONT = (byte) 0x02;
+
+  // hide the default constructor
+  private DssConstants () {}
+}

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/DssConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/EbcdicCcsidManager.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/client/org/apache/derby/client/net/EbcdicCcsidManager.java?rev=165178&view=auto
==============================================================================
--- incubator/derby/code/trunk/java/client/org/apache/derby/client/net/EbcdicCcsidManager.java (added)
+++ incubator/derby/code/trunk/java/client/org/apache/derby/client/net/EbcdicCcsidManager.java Thu Apr 28 12:05:42 2005
@@ -0,0 +1,189 @@
+/*
+
+   Derby - Class org.apache.derby.client.net.EbcdicCcsidManager
+
+   Copyright (c) 2001, 2005 The Apache Software Foundation or its licensors, where applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+*/
+
+package org.apache.derby.client.net;
+
+import org.apache.derby.client.am.SqlException;
+
+/**
+ * A concrete implementation of a CcsidMgr used to convert
+ * between Java UCS2 and Ebcdic as needed to handle character
+ * DDM Parameters.  This implementation only supports converting
+ * from the ASCII invariant of UNICODE to Ebcdic.  This should
+ * be fine since this class is intended for converting
+ * DDM Parameter data only.
+ */
+public class EbcdicCcsidManager extends CcsidManager
+{
+
+  private static final int[] conversionArrayToEbcdic = {
+    0x0000,0x0001,0x0002,0x0003,0x0037,0x002d,0x002e,0x002f
+    ,0x0016,0x0005,0x0025,0x000b,0x000c,0x000d,0x000e,0x000f
+    ,0x0010,0x0011,0x0012,0x0013,0x003c,0x003d,0x0032,0x0026
+    ,0x0018,0x0019,0x003f,0x0027,0x001c,0x001d,0x001e,0x001f
+    ,0x0040,0x004f,0x007f,0x007b,0x005b,0x006c,0x0050,0x007d
+    ,0x004d,0x005d,0x005c,0x004e,0x006b,0x0060,0x004b,0x0061
+    ,0x00f0,0x00f1,0x00f2,0x00f3,0x00f4,0x00f5,0x00f6,0x00f7
+    ,0x00f8,0x00f9,0x007a,0x005e,0x004c,0x007e,0x006e,0x006f
+    ,0x007c,0x00c1,0x00c2,0x00c3,0x00c4,0x00c5,0x00c6,0x00c7
+    ,0x00c8,0x00c9,0x00d1,0x00d2,0x00d3,0x00d4,0x00d5,0x00d6
+    ,0x00d7,0x00d8,0x00d9,0x00e2,0x00e3,0x00e4,0x00e5,0x00e6
+    ,0x00e7,0x00e8,0x00e9,0x004a,0x00e0,0x005a,0x005f,0x006d
+    ,0x0079,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087
+    ,0x0088,0x0089,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096
+    ,0x0097,0x0098,0x0099,0x00a2,0x00a3,0x00a4,0x00a5,0x00a6
+    ,0x00a7,0x00a8,0x00a9,0x00c0,0x00bb,0x00d0,0x00a1,0x0007
+    ,0x0020,0x0021,0x0022,0x0023,0x0024,0x0015,0x0006,0x0017
+    ,0x0028,0x0029,0x002a,0x002b,0x002c,0x0009,0x000a,0x001b
+    ,0x0030,0x0031,0x001a,0x0033,0x0034,0x0035,0x0036,0x0008
+    ,0x0038,0x0039,0x003a,0x003b,0x0004,0x0014,0x003e,0x00ff
+    ,0x0041,0x00aa,0x00b0,0x00b1,0x009f,0x00b2,0x006a,0x00b5
+    ,0x00bd,0x00b4,0x009a,0x008a,0x00ba,0x00ca,0x00af,0x00bc
+    ,0x0090,0x008f,0x00ea,0x00fa,0x00be,0x00a0,0x00b6,0x00b3
+    ,0x009d,0x00da,0x009b,0x008b,0x00b7,0x00b8,0x00b9,0x00ab
+    ,0x0064,0x0065,0x0062,0x0066,0x0063,0x0067,0x009e,0x0068
+    ,0x0074,0x0071,0x0072,0x0073,0x0078,0x0075,0x0076,0x0077
+    ,0x00ac,0x0069,0x00ed,0x00ee,0x00eb,0x00ef,0x00ec,0x00bf
+    ,0x0080,0x00fd,0x00fe,0x00fb,0x00fc,0x00ad,0x00ae,0x0059
+    ,0x0044,0x0045,0x0042,0x0046,0x0043,0x0047,0x009c,0x0048
+    ,0x0054,0x0051,0x0052,0x0053,0x0058,0x0055,0x0056,0x0057
+    ,0x008c,0x0049,0x00cd,0x00ce,0x00cb,0x00cf,0x00cc,0x00e1
+    ,0x0070,0x00dd,0x00de,0x00db,0x00dc,0x008d,0x008e,0x00df
+  };
+
+  private static final int[] conversionArrayToUCS2 = {
+    0x0000,0x0001,0x0002,0x0003,0x009C,0x0009,0x0086,0x007F
+    ,0x0097,0x008D,0x008E,0x000B,0x000C,0x000D,0x000E,0x000F
+    ,0x0010,0x0011,0x0012,0x0013,0x009D,0x0085,0x0008,0x0087
+    ,0x0018,0x0019,0x0092,0x008F,0x001C,0x001D,0x001E,0x001F
+    ,0x0080,0x0081,0x0082,0x0083,0x0084,0x000A,0x0017,0x001B
+    ,0x0088,0x0089,0x008A,0x008B,0x008C,0x0005,0x0006,0x0007
+    ,0x0090,0x0091,0x0016,0x0093,0x0094,0x0095,0x0096,0x0004
+    ,0x0098,0x0099,0x009A,0x009B,0x0014,0x0015,0x009E,0x001A
+    ,0x0020,0x00A0,0x00E2,0x00E4,0x00E0,0x00E1,0x00E3,0x00E5
+    ,0x00E7,0x00F1,0x005B,0x002E,0x003C,0x0028,0x002B,0x0021
+    ,0x0026,0x00E9,0x00EA,0x00EB,0x00E8,0x00ED,0x00EE,0x00EF
+    ,0x00EC,0x00DF,0x005D,0x0024,0x002A,0x0029,0x003B,0x005E
+    ,0x002D,0x002F,0x00C2,0x00C4,0x00C0,0x00C1,0x00C3,0x00C5
+    ,0x00C7,0x00D1,0x00A6,0x002C,0x0025,0x005F,0x003E,0x003F
+    ,0x00F8,0x00C9,0x00CA,0x00CB,0x00C8,0x00CD,0x00CE,0x00CF
+    ,0x00CC,0x0060,0x003A,0x0023,0x0040,0x0027,0x003D,0x0022
+    ,0x00D8,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067
+    ,0x0068,0x0069,0x00AB,0x00BB,0x00F0,0x00FD,0x00FE,0x00B1
+    ,0x00B0,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070
+    ,0x0071,0x0072,0x00AA,0x00BA,0x00E6,0x00B8,0x00C6,0x00A4
+    ,0x00B5,0x007E,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078
+    ,0x0079,0x007A,0x00A1,0x00BF,0x00D0,0x00DD,0x00DE,0x00AE
+    ,0x00A2,0x00A3,0x00A5,0x00B7,0x00A9,0x00A7,0x00B6,0x00BC
+    ,0x00BD,0x00BE,0x00AC,0x007C,0x00AF,0x00A8,0x00B4,0x00D7
+    ,0x007B,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047
+    ,0x0048,0x0049,0x00AD,0x00F4,0x00F6,0x00F2,0x00F3,0x00F5
+    ,0x007D,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050
+    ,0x0051,0x0052,0x00B9,0x00FB,0x00FC,0x00F9,0x00FA,0x00FF
+    ,0x005C,0x00F7,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058
+    ,0x0059,0x005A,0x00B2,0x00D4,0x00D6,0x00D2,0x00D3,0x00D5
+    ,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037
+    ,0x0038,0x0039,0x00B3,0x00DB,0x00DC,0x00D9,0x00DA,0x009F
+  };
+
+  public EbcdicCcsidManager ()
+  {
+    super ((byte) 0x40, // 0x40 is the ebcdic space character
+           (byte) 0x4B,
+           new byte[] {                         //02132002jev begin
+             //     '0',       '1',       '2',       '3',      '4',
+             (byte)0xf0,(byte)0xf1,(byte)0xf2,(byte)0xf3,(byte)0xf4,
+             //     '5',       '6',       '7',       '8',      '9',
+             (byte)0xf5,(byte)0xf6,(byte)0xf7,(byte)0xf8,(byte)0xf9,
+             //     'A',       'B',       'C',       'D',      'E',
+             (byte)0xc1,(byte)0xc2,(byte)0xc3,(byte)0xc4,(byte)0xc5,
+             //      'F'
+             (byte)0xc6 },
+           new byte[] {
+             //     'G',       'H',       'I',       'J',      'K',
+             (byte)0xc7,(byte)0xc8,(byte)0xc9,(byte)0xd1,(byte)0xd2,
+             //     'L',       'M',       'N',       '0',      'P',
+             (byte)0xd3,(byte)0xd4,(byte)0xd5,(byte)0xd6,(byte)0xd7,
+             //     'A',       'B',       'C',       'D',      'E',
+             (byte)0xc1,(byte)0xc2,(byte)0xc3,(byte)0xc4,(byte)0xc5,
+             //      'F'
+             (byte)0xc6 }                     //02132002jev end
+	         );
+  }
+
+  public byte[] convertFromUCS2 (String sourceString, org.apache.derby.client.am.Agent agent) throws SqlException
+  {
+    byte[] bytes = new byte[sourceString.length()];
+    convertFromUCS2 (sourceString, bytes, 0, agent);
+    return bytes;
+  }
+
+  public int convertFromUCS2 (String sourceString,
+		       byte[] buffer,
+		       int offset,
+                       org.apache.derby.client.am.Agent agent) throws SqlException
+  {
+    for (int i=0; i < sourceString.length(); i++) {
+      char c = sourceString.charAt (i);
+      if (c > 0xff)
+        // buffer[offset++] = (byte) 63;
+        throw new SqlException (agent.logWriter_, "Unicode string can't convert to Ebcdic string");
+      else
+        buffer[offset++] = (byte) (conversionArrayToEbcdic [c]); ;
+    }
+    return offset;
+  }
+
+  String convertToUCS2 (byte[] sourceBytes)
+  {
+    int i = 0;
+    char[] theChars = new char[sourceBytes.length];
+    int num = 0;
+
+    for (i=0; i < sourceBytes.length; i++) {
+      num = (sourceBytes[i] < 0) ? (sourceBytes[i] + 256) : sourceBytes[i];
+      theChars[i] = (char) conversionArrayToUCS2[num];
+    }
+
+    return new String (theChars);
+  }
+
+  String convertToUCS2 (byte[] sourceBytes, int offset, int numToConvert)
+  {
+    int i = 0,j = 0;
+    char[] theChars = new char[numToConvert];
+    int num = 0;
+
+    for (i = offset; i < (offset + numToConvert); i++) {
+      num = (sourceBytes[i] < 0 ) ? (sourceBytes[i] + 256) : sourceBytes[i];
+      theChars[j] = (char) conversionArrayToUCS2[num];
+      j++;
+    }
+    return new String (theChars);
+  }
+
+
+  char convertToUCS2Char (byte sourceByte)
+  {
+    return (char) conversionArrayToUCS2[(sourceByte < 0 ) ? (sourceByte + 256) : sourceByte];
+  }
+
+}
+

Propchange: incubator/derby/code/trunk/java/client/org/apache/derby/client/net/EbcdicCcsidManager.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message