You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/05/02 18:11:56 UTC
[17/60] incubator-trafodion git commit: TRAFODION-1933 JDBC TYpe4
driver build scripts migrated to use maven instead of ant
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CONNECTION_CONTEXT_def.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CONNECTION_CONTEXT_def.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CONNECTION_CONTEXT_def.java
deleted file mode 100644
index d38b178..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CONNECTION_CONTEXT_def.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class CONNECTION_CONTEXT_def {
- String datasource = "";
- String catalog = "";
- String schema = "";
- String location = "";
- String userRole = "";
-
- short accessMode;
- short autoCommit;
- short queryTimeoutSec;
- short idleTimeoutSec;
- short loginTimeoutSec;
- short txnIsolationLevel;
- short rowSetSize;
-
- int diagnosticFlag;
- int processId;
-
- String computerName = "";
- String windowText = "";
-
- int ctxACP;
- int ctxDataLang;
- int ctxErrorLang;
- short ctxCtrlInferNXHAR;
-
- short cpuToUse = -1;
- short cpuToUseEnd = -1; // for future use by DBTransporter
-
- String connectOptions = "";
-
- VERSION_LIST_def clientVersionList = new VERSION_LIST_def();
-
- byte[] datasourceBytes;
- byte[] catalogBytes;
- byte[] schemaBytes;
- byte[] locationBytes;
- byte[] userRoleBytes;
- byte[] computerNameBytes;
- byte[] windowTextBytes;
- byte[] connectOptionsBytes;
-
- // ----------------------------------------------------------
- int sizeOf(InterfaceConnection ic) throws CharacterCodingException, UnsupportedCharsetException {
- int size = 0;
-
- datasourceBytes = ic.encodeString(datasource, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- catalogBytes = ic.encodeString(catalog, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- schemaBytes = ic.encodeString(schema, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- locationBytes = ic.encodeString(location, 1);
- userRoleBytes = ic.encodeString(userRole, 1);
- computerNameBytes = ic.encodeString(computerName, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- windowTextBytes = ic.encodeString(windowText, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- connectOptionsBytes = ic.encodeString(connectOptions, 1);
-
- size = TRANSPORT.size_bytes(datasourceBytes);
- size += TRANSPORT.size_bytes(catalogBytes);
- size += TRANSPORT.size_bytes(schemaBytes);
- size += TRANSPORT.size_bytes(locationBytes);
- size += TRANSPORT.size_bytes(userRoleBytes);
-
- size += TRANSPORT.size_short; // accessMode
- size += TRANSPORT.size_short; // autoCommit
- size += TRANSPORT.size_int; // queryTimeoutSec
- size += TRANSPORT.size_int; // idleTimeoutSec
- size += TRANSPORT.size_int; // loginTimeoutSec
- size += TRANSPORT.size_short; // txnIsolationLevel
- size += TRANSPORT.size_short; // rowSetSize
-
- size += TRANSPORT.size_short; // diagnosticFlag
- size += TRANSPORT.size_int; // processId
-
- size += TRANSPORT.size_bytes(computerNameBytes);
- size += TRANSPORT.size_bytes(windowTextBytes);
-
- size += TRANSPORT.size_int; // ctxACP
- size += TRANSPORT.size_int; // ctxDataLang
- size += TRANSPORT.size_int; // ctxErrorLang
- size += TRANSPORT.size_short; // ctxCtrlInferNCHAR
-
- size += TRANSPORT.size_short; // cpuToUse
- size += TRANSPORT.size_short; // cpuToUseEnd
- size += TRANSPORT.size_bytes(connectOptionsBytes);
-
- size += clientVersionList.sizeOf();
-
- return size;
- }
-
- // ----------------------------------------------------------
- void insertIntoByteArray(LogicalByteArray buf) {
- buf.insertString(datasourceBytes);
- buf.insertString(catalogBytes);
- buf.insertString(schemaBytes);
- buf.insertString(locationBytes);
- buf.insertString(userRoleBytes);
-
- buf.insertShort(accessMode);
- buf.insertShort(autoCommit);
- buf.insertInt(queryTimeoutSec);
- buf.insertInt(idleTimeoutSec);
- buf.insertInt(loginTimeoutSec);
- buf.insertShort(txnIsolationLevel);
- buf.insertShort(rowSetSize);
-
- buf.insertInt(diagnosticFlag);
- buf.insertInt(processId);
-
- buf.insertString(computerNameBytes);
- buf.insertString(windowTextBytes);
-
- buf.insertInt(ctxACP);
- buf.insertInt(ctxDataLang);
- buf.insertInt(ctxErrorLang);
- buf.insertShort(ctxCtrlInferNXHAR);
-
- buf.insertShort(cpuToUse);
- buf.insertShort(cpuToUseEnd);
- buf.insertString(connectOptionsBytes);
-
- clientVersionList.insertIntoByteArray(buf);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CachedPreparedStatement.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CachedPreparedStatement.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CachedPreparedStatement.java
deleted file mode 100644
index 5866e04..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CachedPreparedStatement.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-public class CachedPreparedStatement {
-
- PreparedStatement getPreparedStatement() {
- inUse_ = true;
- return pstmt_;
- }
-
- void setLastUsedInfo() {
- lastUsedTime_ = System.currentTimeMillis();
- noOfTimesUsed_++;
- }
-
- long getLastUsedTime() {
- return lastUsedTime_;
- }
-
- String getLookUpKey() {
- return key_;
- }
-
- void close(boolean hardClose) throws SQLException {
- inUse_ = false;
- pstmt_.close(hardClose);
- }
-
- CachedPreparedStatement(PreparedStatement pstmt, String key) {
- pstmt_ = (TrafT4PreparedStatement) pstmt;
- key_ = key;
- creationTime_ = System.currentTimeMillis();
- lastUsedTime_ = creationTime_;
- noOfTimesUsed_ = 1;
- inUse_ = true;
- }
-
- private TrafT4PreparedStatement pstmt_;
- private String key_;
- private long lastUsedTime_;
- private long creationTime_;
- private long noOfTimesUsed_;
- boolean inUse_;
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelMessage.java
deleted file mode 100644
index b8347a2..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelMessage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class CancelMessage {
- static LogicalByteArray marshal(int dialogueId, int srvrType, String srvrObjRef, int stopType,
- InterfaceConnection ic) throws UnsupportedCharsetException, CharacterCodingException {
- int wlength = Header.sizeOf();
- LogicalByteArray buf = null;
-
- byte[] srvrObjRefBytes = ic.encodeString(srvrObjRef, 1);
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_int; // srvrType
- wlength += TRANSPORT.size_bytes(srvrObjRefBytes); // srvrObjReference
- wlength += TRANSPORT.size_int; // stopType
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertInt(srvrType);
- buf.insertString(srvrObjRefBytes);
- buf.insertInt(stopType);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelReply.java
deleted file mode 100644
index b3eb6f0..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CancelReply.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-
-class CancelReply {
- odbc_Dcs_StopSrvr_exc_ m_p1_exception;
-
- // -------------------------------------------------------------
- CancelReply(LogicalByteArray buf, InterfaceConnection ic) throws SQLException, CharacterCodingException,
- UnsupportedCharsetException {
- buf.setLocation(Header.sizeOf());
-
- m_p1_exception = new odbc_Dcs_StopSrvr_exc_();
- m_p1_exception.extractFromByteArray(buf, ic);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Certificate.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Certificate.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Certificate.java
deleted file mode 100644
index eedc663..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Certificate.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
- //
- **********************************************************************/
-/**
- * Certificate.java
- * This class get the x509 certificate from an input file and stores
- * the certificate in the m_cert member.
- */
-
-package org.trafodion.jdbc.t4;
-
-import java.security.cert.X509Certificate;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.util.TimeZone;
-
-public class Certificate
-{
- /**
- * Ctor - Gets certificate and the certificate's expiration
- * date from the certificate file.
- * @param certFile - the certificate file which stores the
- * public key.
- * @throws SecurityException
- */
- public Certificate(File certFile)
- throws SecurityException
- {
- InputStream inStream = null;
- try
- {
- inStream = new FileInputStream(certFile);
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- m_cert = (X509Certificate) cf.generateCertificate(inStream);
- // Get certificate expiration date
- Date expDate = m_cert.getNotAfter();
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
- String fDate = sdf.format(expDate);
- m_certExpDate = fDate.getBytes();
- }
- catch (CertificateException cex)
- {
- throw new SecurityException(SecClientMsgKeys.FILE_CORRUPTION, new Object[]{certFile.getName()} );
- }
- catch (Exception ex)
- {
- // This should never happen
- throw new SecurityException(SecClientMsgKeys.FILE_NOTFOUND, new Object[]{certFile.getName()} );
- }
- finally
- {
- try
- {
- if (inStream != null) inStream.close();
- }
- catch (IOException io)
- {
- // Notmuch to do at this point
- }
- }
- }
-
- /**
- * returns the expiration date of the certificate
- * @return an array of byte representing the expiration
- * date of the certificate in the String format
- * "yyMMddHHmmss"
- */
- public byte[] getCertExpDate()
- {
- return m_certExpDate;
- }
-
- /**
- * @return the X509Certificate
- */
- public X509Certificate getCert()
- {
- return m_cert;
- }
-
- private X509Certificate m_cert;
- private byte[] m_certExpDate;
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Cipher.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Cipher.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Cipher.java
deleted file mode 100644
index 32c0ef9..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Cipher.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/**********************************************************************
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-//
-**********************************************************************/
-
-/**
- * class Cipher - Encrypts and decrypts data and password using
- * symmetric key and key pair
- *
- */
-
-package org.trafodion.jdbc.t4;
-
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.SecretKey;
-
-
-
-public class Cipher
-{
- private static class Holder
- {
- private static Cipher instance = new Cipher();
- }
-
- /**
- *
- * @return Cipher
- */
- public static Cipher getInstance()
- {
- return Holder.instance;
- }
-
- /** Encrypts plain text and stores the
- * cipher text in cipherText using public key for password encryption.
- * @param plainText - plain text to be encrypted
- * @param cipherText - encrypted plain text is returned
- * @param key - password encryption: public key
- * @Return the length of the cipher text or -1 in case of error
- * @throws SecurityException
- */
- public int encrypt(byte[] plainText, byte[] cipherText,
- java.security.Key key) throws SecurityException
- {
- int len = 0;
-
- if (plainText == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"plainText"});
- if (cipherText == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"cipherText"});
- if (key == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"key"});
-
- try {
- // Obtain a RSA Cipher Object
- // RSA algorithm, ECB:Electronic Codebook Mode mode,
- // PKCS1Padding: PKCS1 padding
- javax.crypto.Cipher cipher = javax.crypto.Cipher.
- getInstance("RSA/ECB/PKCS1Padding");
- byte[] tmpCipherText;
- synchronized(cipher) {
- cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);
-
- tmpCipherText = cipher.doFinal(plainText);
- }
-
- System.arraycopy(tmpCipherText, 0, cipherText, 0, tmpCipherText.length);
-
- len = cipherText.length;
- }catch (Exception ex) {
- throw new SecurityException(SecClientMsgKeys.ENCRYPTION_FAILED, null);
- }
- return len;
- }
-
- public static javax.crypto.Cipher getEASInstance(String algorithm) throws SecurityException
- {
- if (algorithm == null)
- throw new SecurityException(SecClientMsgKeys.INPUT_PARAMETER_IS_NULL, new Object[]{"algorithm"});
- try {
- // Obtain a AES Cipher Object
- // AES algorithm using a cryptographic key of 128 bits
- // to encrypt data in blocks of 128 bits,
- // CBC cipher mode, PKCS5Padding padding
-
- return javax.crypto.Cipher.getInstance("AES/CBC/PKCS5Padding");
- } catch (Exception ex) {
- throw new SecurityException(SecClientMsgKeys.ENCRYPTION_FAILED, null);
- }
- }
-
- /** Encrypts the plain text data message using "EAS256/CBC/PKCS7"
- * @param plainText - plain text to be encrypted
- * @param key - session key is used as secret key
- * @param iv - 16 lower bytes of the nonce is used as the initial vector.
- * Can't use the whole 32 bytes nonce because the IV size has
- * to be equal to the block size which is a Java requirement.
- * @Return the cipher text in byte
- * @throws SecurityException
- */
- public static byte[] encryptData(byte[] plainText, SecretKey key, byte[] iv,
- javax.crypto.Cipher cipher)
- throws SecurityException
- {
- if (plainText == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"plainText"});
- if (key == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"key"});
- if (iv == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"iv"});
-
- try {
- IvParameterSpec initialVector = new IvParameterSpec(iv);
-
- synchronized (cipher) {
- cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key, initialVector);
-
- return cipher.doFinal(plainText);
- }
-
- }catch (Exception ex) {
- throw new SecurityException(SecClientMsgKeys.DATA_ENCRYPTION_FAILED, null);
- }
- }
-
- /** Decrypts cipherText and stores the
- * plain text in plainText using private key for password
- * decryption or symmetric key for data decryption
- *
- * @param cipherText cipher text to be decrypted
- * @param plainText decrypted cipher text is returned
- * @param key password decryption: private key
- * message encryption: session key
- * @param iv 8 sequence nonce is used as the initial vector for symmetric
- * key encryption. Null if is private key encryption
- * @return the length of the plain text or -1 in case of error
- * @throws SecurityException
- */
- public int decrypt(byte[] cipherText, byte[] plainText,
- java.security.Key key, byte[] iv) throws SecurityException
- {
- int len = 0;
- if (iv == null) //Private key decyption
- {
- if (plainText == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"plainText"});
- if (cipherText == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"cipherText"});
- if (key == null)
- throw new SecurityException(SecClientMsgKeys.
- INPUT_PARAMETER_IS_NULL, new Object[]{"key"});
- try {
- // Obtain a RSA Cipher Object
- // RSA algorithm, ECB:Electronic Code book Mode mode,
- // PKCS1Padding: PKCS1 padding
- javax.crypto.Cipher cipher = javax.crypto.Cipher.
- getInstance("RSA/ECB/PKCS1Padding");
- byte[] tmpPlainText ;
- synchronized (cipher) {
- cipher.init(javax.crypto.Cipher.DECRYPT_MODE, key);
- tmpPlainText = cipher.doFinal(cipherText);
- }
- System.arraycopy(tmpPlainText, 0, plainText, 0, tmpPlainText.length);
-
- len = plainText.length;
- }catch (Exception ex) {
- throw new SecurityException(SecClientMsgKeys.DECRYPTION_FAILED, null);
- }
- }
-
- return len;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseMessage.java
deleted file mode 100644
index 30c23fe..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseMessage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class CloseMessage {
- // ----------------------------------------------------------
- static LogicalByteArray marshal(int dialogueId, String stmtLabel, short freeResourceOpt, InterfaceConnection ic)
- throws UnsupportedCharsetException, CharacterCodingException {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- byte[] stmtLabelBytes = ic.encodeString(stmtLabel, InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_bytes(stmtLabelBytes);
- wlength += TRANSPORT.size_short; // freeResourceOpt
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertString(stmtLabelBytes);
- buf.insertShort(freeResourceOpt);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseReply.java
deleted file mode 100644
index 91bb2a7..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/CloseReply.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-
-class CloseReply {
- odbc_SQLSvc_Close_exc_ m_p1;
- int m_p2;
- ERROR_DESC_LIST_def m_p3;
-
- // -------------------------------------------------------------
- CloseReply(LogicalByteArray buf, String addr, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException, SQLException {
- buf.setLocation(Header.sizeOf());
-
- m_p1 = new odbc_SQLSvc_Close_exc_();
- m_p1.extractFromByteArray(buf, addr, ic);
-
- if (m_p1.exception_nr != TRANSPORT.CEE_SUCCESS) {
- m_p2 = buf.extractInt();
-
- m_p3 = new ERROR_DESC_LIST_def();
- m_p3.extractFromByteArray(buf, ic);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Compression.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Compression.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Compression.java
deleted file mode 100644
index bb2bb8f..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Compression.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-package org.trafodion.jdbc.t4;
-
-public class Compression {
- private static int MAXCOUNT = 0xFF;
- // private static int MAXUCOUNT = 0xFFFF;
- private static int EOFCHAR = -1;
-
-
-
- public static int compress(int alg, byte [][] sbuf, int [] sstart, int [] slen, byte[] dbuf, int dstart) {
- int ret = 0;
-
- switch(alg) {
- case 1:
- ret = compress_whitespace(sbuf, sstart, slen, dbuf, dstart);
- break;
- }
-
- return ret;
- }
-
- public static int uncompress(int alg, byte [] sbuf, int sstart, int slen, byte [] dbuf, int dstart) {
- int ret = 0;
-
- switch(alg) {
- case 1:
- ret = uncompress_whitespace(sbuf, sstart, slen, dbuf, dstart);
- break;
- }
-
- return ret;
- }
-
- // encodes repeated bytes in the byte form <b><b><#>
- // b = byte which is repeated
- // # = number of repetitions (max 255)
- // source buffers, source lengths, destination buffer
- private static int compress_whitespace(byte [][] param_sbuf, int [] param_sstart, int [] param_slen, byte[] dbuf, int dstart) {
- int c = EOFCHAR, p = EOFCHAR;
- int si = 0, di = dstart; // source, destination indexes
- int cnt = 0; // count of repetition
-
- byte []sbuf; //current source buffer
- int slen; //current source length
-
- for(int i=0;i<param_sbuf.length;i++) {
- sbuf = param_sbuf[i];
- slen = param_slen[i];
- si = param_sstart[i];
-
- while(si < slen) {
- c = sbuf[si++]; // get the next byte from source
- dbuf[di++] = (byte)c; // copy the byte to destination
- cnt = 0;
-
- if(c == p) { // check repetition
- if(si == slen) {
- c = EOFCHAR;
- }
- while(si < slen) {
- if ((c = sbuf[si++]) == p) { // found repetition
- cnt++;
- if (cnt == MAXCOUNT) { // we can only store 255 in
- // a byte
- dbuf[di++] = (byte)cnt;
-
- p = EOFCHAR; // move on
- break;
- }
- }
- else {
- dbuf[di++] = (byte)cnt;
- dbuf[di++] = (byte) c;
-
- p = c;
- break;
- }
-
- if (si == slen) {
- c = EOFCHAR;
- }
- }
- }
- else {
- p = c; // set our current as our previous
- }
-
- if (c == EOFCHAR) {
- dbuf[di++] = (byte)cnt;
- /*
- * ADDED
- */
- p = EOFCHAR;
- }
- }
- }
-
- return di - dstart;
- }
-
- private static int uncompress_whitespace(byte [] sbuf, int sstart, int slen, byte [] dbuf, int dstart) {
- int c = EOFCHAR, p = EOFCHAR;
- int si = sstart, di = dstart, i = 0; // source, dest, and generic indexes
- int cnt = 0;
-
- while(si < slen ) {
- c = sbuf[si++] & 0xFF;
-
- /*if(di >= dbuf.length) {
- System.out.println("%%%%%failed at " + di);
- }*/
- dbuf[di++] = (byte) c;
-
- if(c == p) {
- cnt = sbuf[si++] & 0xFF;
-
- for(i=0;i<cnt;++i) {
- dbuf[di++] = (byte)c;
- }
- p = EOFCHAR;
- }
- else {
- p = c;
- }
- }
-
- return di;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectMessage.java
deleted file mode 100644
index fd594d5..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectMessage.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class ConnectMessage {
- static LogicalByteArray marshal(CONNECTION_CONTEXT_def inContext, USER_DESC_def userDesc, int srvrType,
- short retryCount, int optionFlags1, int optionFlags2, String vproc, InterfaceConnection ic)
- throws CharacterCodingException, UnsupportedCharsetException {
- int wlength = Header.sizeOf();
- LogicalByteArray buf = null;
-
- byte[] vprocBytes = ic.encodeString(vproc, 1);
- byte[] clientUserBytes = ic.encodeString(System.getProperty("user.name"), 1);
-
- wlength += inContext.sizeOf(ic);
- wlength += userDesc.sizeOf(ic);
-
- wlength += TRANSPORT.size_int; // srvrType
- wlength += TRANSPORT.size_short; // retryCount
- wlength += TRANSPORT.size_int; // optionFlags1
- wlength += TRANSPORT.size_int; // optionFlags2
- wlength += TRANSPORT.size_bytes(vprocBytes);
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- inContext.insertIntoByteArray(buf);
- userDesc.insertIntoByteArray(buf);
-
- buf.insertInt(srvrType);
- buf.insertShort(retryCount);
- buf.insertInt(optionFlags1);
- buf.insertInt(optionFlags2);
- buf.insertString(vprocBytes);
-
- //TODO: restructure all the flags and this new param
- buf.insertString(clientUserBytes);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectReply.java
deleted file mode 100644
index f11b5d5..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ConnectReply.java
+++ /dev/null
@@ -1,148 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-import java.util.Locale;
-
-class ConnectReply {
- odbc_Dcs_GetObjRefHdl_exc_ m_p1_exception;
- String m_p2_srvrObjRef;
- int m_p3_dialogueId;
- String m_p4_dataSource;
- byte[] m_p5_userSid;
- VERSION_LIST_def m_p6_versionList;
- int isoMapping;
- boolean byteSwap;
-
- boolean securityEnabled;
- int serverNode;
- int processId;
- byte [] timestamp;
- String clusterName;
-
- String serverHostName="";
- Integer serverNodeId=0;
- Integer serverProcessId=0;
- String serverProcessName="";
- String serverIpAddress="";
- Integer serverPort=0;
-
- String remoteHost;
- String remoteProcess;
-
- private NCSAddress m_ncsAddr_;
-
- // -------------------------------------------------------------
- ConnectReply(LogicalByteArray buf, InterfaceConnection ic) throws SQLException, UnsupportedCharsetException,
- CharacterCodingException {
- buf.setLocation(Header.sizeOf());
-
- m_p1_exception = new odbc_Dcs_GetObjRefHdl_exc_();
- m_p1_exception.extractFromByteArray(buf, ic);
-
- this.byteSwap = buf.getByteSwap();
-
- if (m_p1_exception.exception_nr == TRANSPORT.CEE_SUCCESS) {
- m_p3_dialogueId = buf.extractInt();
- m_p4_dataSource = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- m_p5_userSid = buf.extractByteString(); // byteString -- only place
- // used -- packed length
- // does not include the null
- // term
- m_p6_versionList = new VERSION_LIST_def();
-
- //buf.setByteSwap(false);
- m_p6_versionList.extractFromByteArray(buf);
- //buf.setByteSwap(this.byteSwap);
-
- buf.extractInt(); //old iso mapping
-
- /*if ((m_p6_versionList.list[0].buildId & InterfaceConnection.CHARSET) > 0) {
- isoMapping =
- } else {*/
- isoMapping = 15;
- //}
- serverHostName = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- serverNodeId = buf.extractInt();
- serverProcessId = buf.extractInt();
- serverProcessName = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- serverIpAddress = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- serverPort = buf.extractInt();
-
- m_p2_srvrObjRef = String.format("TCP:%s:%d.%s,%s/%d:ODBC", serverHostName, serverNodeId, serverProcessName, serverIpAddress, serverPort);
-
- if((m_p6_versionList.list[0].buildId & InterfaceConnection.PASSWORD_SECURITY) > 0) {
- securityEnabled = true;
- serverNode = serverNodeId;
- processId = serverProcessId;
- timestamp = buf.extractByteArray(8);
- clusterName = ic.decodeBytes(buf.extractString(), 1);
- }
- else {
- securityEnabled = false;
- }
- }
- }
-
- // -------------------------------------------------------------
- void fixupSrvrObjRef(T4Properties t4props, Locale locale, String name) throws SQLException {
- //
- // This method will replace the domain name returned from the
- // Association server, with a new name.
- //
- m_ncsAddr_ = null;
-
- if (m_p2_srvrObjRef != null) {
- remoteHost = m_p2_srvrObjRef.substring(4,m_p2_srvrObjRef.indexOf('$') - 1);
- remoteProcess = m_p2_srvrObjRef.substring(m_p2_srvrObjRef.indexOf('$'), m_p2_srvrObjRef.indexOf(','));
-
- try {
- m_ncsAddr_ = new NCSAddress(t4props, locale, m_p2_srvrObjRef);
- } catch (SQLException e) {
- throw e;
- }
-
- // use your best guess if m_machineName was not found
- if (m_ncsAddr_.m_machineName == null) {
- if (m_ncsAddr_.m_ipAddress == null) {
- m_ncsAddr_.m_machineName = name;
- } else {
- m_ncsAddr_.m_machineName = m_ncsAddr_.m_ipAddress;
- }
- }
-
- m_p2_srvrObjRef = m_ncsAddr_.recreateAddress();
- m_ncsAddr_.validateAddress();
- m_ncsAddr_.setInputOutput();
-
- return;
- } // end if
-
- } // end fixupSrvrObjRef
-
- NCSAddress getNCSAddress() {
- return m_ncsAddr_;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Descriptor2.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Descriptor2.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Descriptor2.java
deleted file mode 100644
index fd25f51..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/Descriptor2.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class Descriptor2 {
- int noNullValue_;
- int nullValue_;
- int version_;
- int dataType_;
- int datetimeCode_;
- int maxLen_;
- int precision_;
- int scale_;
- int nullInfo_;
- int signed_;
- int odbcDataType_;
- int odbcPrecision_;
- int sqlCharset_;
- int odbcCharset_;
- String colHeadingNm_;
- String tableName_;
- String catalogName_;
- String schemaName_;
- String headingName_;
- int intLeadPrec_;
- int paramMode_;
-
- private int rowLength;
-
- public void setRowLength(int len) {
- rowLength = len;
- }
-
- public int getRowLength() {
- return rowLength;
- }
-
- public Descriptor2(LogicalByteArray buf, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException {
- noNullValue_ = buf.extractInt();
- nullValue_ = buf.extractInt();
- version_ = buf.extractInt();
- dataType_ = buf.extractInt();
- datetimeCode_ = buf.extractInt();
- maxLen_ = buf.extractInt();
- precision_ = buf.extractInt();
- scale_ = buf.extractInt();
- nullInfo_ = buf.extractInt();
- signed_ = buf.extractInt();
- odbcDataType_ = buf.extractInt();
- odbcPrecision_ = buf.extractInt();
- sqlCharset_ = buf.extractInt();
- odbcCharset_ = buf.extractInt();
-
- colHeadingNm_ = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- tableName_ = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- catalogName_ = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- schemaName_ = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- headingName_ = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- intLeadPrec_ = buf.extractInt();
- paramMode_ = buf.extractInt();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_LIST_def.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_LIST_def.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_LIST_def.java
deleted file mode 100644
index 039fae3..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_LIST_def.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class ERROR_DESC_LIST_def {
- int length;
- ERROR_DESC_def[] buffer;
-
- // ----------------------------------------------------------
- void extractFromByteArray(LogicalByteArray buf, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException {
- length = buf.extractInt();
- buffer = new ERROR_DESC_def[length];
-
- for (int i = 0; i < length; i++) {
- buffer[i] = new ERROR_DESC_def();
- buffer[i].extractFromByteArray(buf, ic);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_def.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_def.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_def.java
deleted file mode 100644
index 48ebba2..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ERROR_DESC_def.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class ERROR_DESC_def {
- int rowId;
- int errorDiagnosticId;
- int sqlcode;
- String sqlstate;
- String errorText;
- int operationAbortId;
- int errorCodeType;
- String Param1;
- String Param2;
- String Param3;
- String Param4;
- String Param5;
- String Param6;
- String Param7;
-
- // ----------------------------------------------------------
- void extractFromByteArray(LogicalByteArray buffer1, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException {
- rowId = buffer1.extractInt();
- errorDiagnosticId = buffer1.extractInt();
- sqlcode = buffer1.extractInt();
-
- // Note, SQLSTATE is logically 5 bytes, but ODBC uses 6 bytes for some
- // reason.
- sqlstate = ic.decodeBytes(buffer1.extractByteArray(6), 1);
- errorText = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- operationAbortId = buffer1.extractInt();
- errorCodeType = buffer1.extractInt();
- Param1 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param2 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param3 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param4 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param5 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param6 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- Param7 = ic.decodeBytes(buffer1.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionMessage.java
deleted file mode 100644
index 98a60d4..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionMessage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-class EndTransactionMessage {
- int m_dialogueId;
- short m_transactionOpt;
-
- // ----------------------------------------------------------
- EndTransactionMessage(int dialogueId, short transactionOpt) {
- m_dialogueId = dialogueId;
- m_transactionOpt = transactionOpt;
- }
-
- // ----------------------------------------------------------
- static LogicalByteArray marshal(int dialogueId, short transactionOpt, InterfaceConnection ic) {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_short; // transactionOpt
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertShort(transactionOpt);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionReply.java
deleted file mode 100644
index b85ce2f..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/EndTransactionReply.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-
-class EndTransactionReply {
- odbc_SQLSvc_EndTransaction_exc_ m_p1;
- ERROR_DESC_LIST_def m_p2;
-
- // -------------------------------------------------------------
- EndTransactionReply(LogicalByteArray buf, String addr, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException, SQLException {
- buf.setLocation(Header.sizeOf());
-
- m_p1 = new odbc_SQLSvc_EndTransaction_exc_();
- m_p1.extractFromByteArray(buf, addr, ic);
-
- if (m_p1.exception_nr != TRANSPORT.CEE_SUCCESS) {
- int totalLen = buf.extractInt();
-
- if(totalLen > 0) {
- m_p2 = new ERROR_DESC_LIST_def();
- m_p2.extractFromByteArray(buf, ic);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteMessage.java
deleted file mode 100644
index 2911bf9..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteMessage.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class ExecuteMessage {
- // ----------------------------------------------------------
- static LogicalByteArray marshal(int dialogueId, int sqlAsyncEnable, int queryTimeout, int inputRowCnt,
- int maxRowsetSize, int sqlStmtType, int stmtHandle, int stmtType, String sqlString, int sqlStringCharset,
- String cursorName, int cursorNameCharset, String stmtLabel, int stmtLabelCharset, String stmtExplainLabel,
- SQL_DataValue_def inputDataValue, SQLValueList_def inputValueList, byte[] txId, boolean isUserBuffer,
- InterfaceConnection ic
-
- ) throws CharacterCodingException, UnsupportedCharsetException
-
- {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- byte[] sqlStringBytes = ic.encodeString(sqlString, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] cursorNameBytes = ic.encodeString(cursorName, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] stmtLabelBytes = ic.encodeString(stmtLabel, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] stmtExplainLabelBytes = ic.encodeString(stmtExplainLabel, InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_int; // sqlAsyncEnable
- wlength += TRANSPORT.size_int; // queryTimeout
- wlength += TRANSPORT.size_int; // inputRowCnt
- wlength += TRANSPORT.size_int; // maxRowsetSize
- wlength += TRANSPORT.size_int; // sqlStmtType
- wlength += TRANSPORT.size_int; // stmtHandle
- wlength += TRANSPORT.size_int; // stmtType
- wlength += TRANSPORT.size_bytesWithCharset(sqlStringBytes); // +sqlStringCharset
- wlength += TRANSPORT.size_bytesWithCharset(cursorNameBytes); // +cursorNameCharset
- wlength += TRANSPORT.size_bytesWithCharset(stmtLabelBytes); // +stmtLabelCharset
- wlength += TRANSPORT.size_bytes(stmtExplainLabelBytes);
-
- if (!isUserBuffer) {
- wlength += inputDataValue.sizeof();
- wlength += TRANSPORT.size_bytes(txId); // transId
- }
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertInt(sqlAsyncEnable);
- buf.insertInt(queryTimeout);
- buf.insertInt(inputRowCnt);
- buf.insertInt(maxRowsetSize);
- buf.insertInt(sqlStmtType);
- buf.insertInt(stmtHandle);
- buf.insertInt(stmtType);
- buf.insertStringWithCharset(sqlStringBytes, sqlStringCharset);
- buf.insertStringWithCharset(cursorNameBytes, cursorNameCharset);
- buf.insertStringWithCharset(stmtLabelBytes, stmtLabelCharset);
- buf.insertString(stmtExplainLabelBytes);
-
- if (isUserBuffer) {
- buf.setDataBuffer(inputDataValue.userBuffer);
-
- byte[] trailer = null;
- if (txId == null || txId.length == 0) {
- trailer = new byte[4];
- for (int i = 0; i < 4; ++i) {
- trailer[i] = (byte) 0;
- }
- } else {
- int len = txId.length + 1;
- trailer = new byte[4 + txId.length + 1];
-
- trailer[0] = (byte) ((len >>> 24) & 0xff);
- trailer[1] = (byte) ((len >>> 16) & 0xff);
- trailer[2] = (byte) ((len >>> 8) & 0xff);
- trailer[3] = (byte) ((len) & 0xff);
- System.arraycopy(txId, 0, trailer, 4, txId.length);
- trailer[len + 4 - 1] = '\0';
- }
-
- buf.setTrailer(trailer);
- } else {
- inputDataValue.insertIntoByteArray(buf);
- buf.insertString(txId);
- }
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteReply.java
deleted file mode 100644
index 664c71f..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/ExecuteReply.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class ExecuteReply {
- int returnCode;
- int totalErrorLength;
- SQLWarningOrError[] errorList;
- long rowsAffected;
- int queryType;
- int estimatedCost;
- byte[] outValues;
-
- int numResultSets;
- Descriptor2[][] outputDesc;
- String stmtLabels[];
-
- int outputParamLength;
- int outputNumberParams;
-
- String[] proxySyntax;
-
- // ----------------------------------------------------------
- ExecuteReply(LogicalByteArray buf, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException {
-
- buf.setLocation(Header.sizeOf());
-
- returnCode = buf.extractInt();
-
- totalErrorLength = buf.extractInt();
-
- if (totalErrorLength > 0) {
- errorList = new SQLWarningOrError[buf.extractInt()];
- for (int i = 0; i < errorList.length; i++) {
- errorList[i] = new SQLWarningOrError(buf, ic, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- }
- }
-
- int outputDescLength = buf.extractInt();
- if (outputDescLength > 0) {
- outputDesc = new Descriptor2[1][];
-
- outputParamLength = buf.extractInt();
- outputNumberParams = buf.extractInt();
-
- outputDesc[0] = new Descriptor2[outputNumberParams];
- for (int i = 0; i < outputNumberParams; i++) {
- outputDesc[0][i] = new Descriptor2(buf, ic);
- outputDesc[0][i].setRowLength(outputParamLength);
- }
- }
- rowsAffected = buf.extractUnsignedInt();
- queryType = buf.extractInt();
- estimatedCost = buf.extractInt();
-
- // 64 bit rowsAffected
- // this is a horrible hack because we cannot change the protocol yet
- // rowsAffected should be made a regular 64 bit value when possible
- rowsAffected |= ((long) estimatedCost) << 32;
-
- outValues = buf.extractByteArray();
-
- numResultSets = buf.extractInt();
-
- if (numResultSets > 0) {
- outputDesc = new Descriptor2[numResultSets][];
- stmtLabels = new String[numResultSets];
- proxySyntax = new String[numResultSets];
-
- for (int i = 0; i < numResultSets; i++) {
- buf.extractInt(); // int stmt_handle
-
- stmtLabels[i] = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- buf.extractInt(); // long stmt_label_charset
- outputDescLength = buf.extractInt();
-
- int outputParamsLength = 0;
- int outputNumberParams = 0;
- Descriptor2[] outputParams = null;
-
- if (outputDescLength > 0) {
- outputParamsLength = buf.extractInt();
- outputNumberParams = buf.extractInt();
-
- outputParams = new Descriptor2[outputNumberParams];
- for (int j = 0; j < outputNumberParams; j++) {
- outputParams[j] = new Descriptor2(buf, ic);
- outputParams[j].setRowLength(outputParamsLength);
- }
- }
- outputDesc[i] = outputParams;
- proxySyntax[i] = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- }
- }
-
- String singleSyntax = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- if (proxySyntax == null) {
- proxySyntax = new String[1];
- proxySyntax[0] = singleSyntax;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchMessage.java
deleted file mode 100644
index 0f7d702..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchMessage.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class FetchMessage {
- // ----------------------------------------------------------
- static LogicalByteArray marshal(int dialogueId, int sqlAsyncEnable, int queryTimeout, int stmtHandle,
- String stmtLabel, int stmtCharset, int maxRowCnt, int maxRowLen, String cursorName, int cursorCharset,
- String stmtOptions, InterfaceConnection ic) throws CharacterCodingException, UnsupportedCharsetException {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- byte[] stmtLabelBytes = ic.encodeString(stmtLabel, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] cursorNameBytes = ic.encodeString(cursorName, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] stmtOptionsBytes = ic.encodeString(stmtOptions, InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_int; // sqlAsyncEnable
- wlength += TRANSPORT.size_int; // queryTimeout
- wlength += TRANSPORT.size_int; // stmtHandle
- wlength += TRANSPORT.size_bytesWithCharset(stmtLabelBytes);
- wlength += TRANSPORT.size_long; // maxRowCnt
- wlength += TRANSPORT.size_long; // maxRowLen
- wlength += TRANSPORT.size_bytesWithCharset(cursorNameBytes);
- wlength += TRANSPORT.size_bytes(stmtOptionsBytes);
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertInt(sqlAsyncEnable);
- buf.insertInt(queryTimeout);
- buf.insertInt(stmtHandle);
- buf.insertStringWithCharset(stmtLabelBytes, stmtCharset);
- buf.insertLong(maxRowCnt);
- buf.insertLong(maxRowLen);
- buf.insertStringWithCharset(cursorNameBytes, cursorCharset);
- buf.insertString(stmtOptionsBytes);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchReply.java
deleted file mode 100644
index 5e82439..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/FetchReply.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class FetchReply {
- int returnCode;
- int totalErrorLength;
- SQLWarningOrError[] errorList;
- int rowsAffected;
- int outValuesFormat;
- byte[] outValues;
-
- // -------------------------------------------------------------
- public FetchReply(LogicalByteArray buf, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException {
- buf.setLocation(Header.sizeOf());
-
- returnCode = buf.extractInt();
-
- if (returnCode != TRANSPORT.SQL_SUCCESS && returnCode != TRANSPORT.NO_DATA_FOUND) {
- totalErrorLength = buf.extractInt();
- if (totalErrorLength > 0) {
- errorList = new SQLWarningOrError[buf.extractInt()];
- for (int i = 0; i < errorList.length; i++) {
- errorList[i] = new SQLWarningOrError(buf, ic, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- }
- }
- }
-
- if (errorList == null) {
- errorList = new SQLWarningOrError[0];
- }
-
- rowsAffected = buf.extractInt();
- outValuesFormat = buf.extractInt();
-
- if (returnCode == TRANSPORT.SQL_SUCCESS || returnCode == TRANSPORT.SQL_SUCCESS_WITH_INFO) {
- outValues = buf.extractByteArray();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericMessage.java
deleted file mode 100644
index 3558872..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericMessage.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.sql.SQLException;
-import java.util.Locale;
-
-class GenericMessage {
- // ----------------------------------------------------------
- static LogicalByteArray marshal(Locale locale, byte[] messageBuffer, InterfaceConnection ic) throws SQLException
-
- {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- if (messageBuffer != null)
- wlength += messageBuffer.length;
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
- if (messageBuffer != null)
- buf.insertByteArray(messageBuffer, messageBuffer.length);
-
- return buf;
- } // end marshal
-
-} // end class GenericMessage
-
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericReply.java
deleted file mode 100644
index 1aa2e8e..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GenericReply.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.sql.SQLException;
-import java.util.Locale;
-
-class GenericReply {
- byte[] replyBuffer;
-
- // ----------------------------------------------------------
- GenericReply(Locale locale, LogicalByteArray buf) throws SQLException {
- Header header = new Header();
- long bufferLength = 0;
-
- buf.setLocation(0);
- header.extractFromByteArray(buf);
- buf.setLocation(Header.sizeOf());
- bufferLength = header.total_length_;
- replyBuffer = buf.extractByteArray(bufferLength);
-
- } // end marshal
-
-} // end class GenericReply
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsMessage.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsMessage.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsMessage.java
deleted file mode 100644
index 17296f6..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsMessage.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-
-class GetSQLCatalogsMessage {
- static LogicalByteArray marshal(int dialogueId, String stmtLabel, short APIType, String catalogNm, String schemaNm,
- String tableNm, String tableTypeList, String columnNm, int columnType, int rowIdScope, int nullable,
- int uniqueness, int accuracy, short sqlType, int metadataId, String fkCatalogNm, String fkSchemaNm,
- String fkTableNm, InterfaceConnection ic) throws CharacterCodingException, UnsupportedCharsetException {
- int wlength = Header.sizeOf();
- LogicalByteArray buf;
-
- byte[] stmtLabelBytes = ic.encodeString(stmtLabel, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] catalogNmBytes = ic.encodeString(catalogNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] schemaNmBytes = ic.encodeString(schemaNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] tableNmBytes = ic.encodeString(tableNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] tableTypeListBytes = ic.encodeString(tableTypeList, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] columnNmBytes = ic.encodeString(columnNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- byte[] fkCatalogNmBytes = ic.encodeString(fkCatalogNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] fkSchemaNmBytes = ic.encodeString(fkSchemaNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
- byte[] fkTableNmBytes = ic.encodeString(fkTableNm, InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- wlength += TRANSPORT.size_int; // dialogueId
- wlength += TRANSPORT.size_bytes(stmtLabelBytes);
- wlength += TRANSPORT.size_short; // APIType
- wlength += TRANSPORT.size_bytes(catalogNmBytes, true);
- wlength += TRANSPORT.size_bytes(schemaNmBytes, true);
- wlength += TRANSPORT.size_bytes(tableNmBytes, true);
- wlength += TRANSPORT.size_bytes(tableTypeListBytes, true);
- wlength += TRANSPORT.size_bytes(columnNmBytes, true);
- wlength += TRANSPORT.size_int; // columnType
- wlength += TRANSPORT.size_int; // rowIdScope
- wlength += TRANSPORT.size_int; // nullable
- wlength += TRANSPORT.size_int; // uniqueness
- wlength += TRANSPORT.size_int; // accuracy
- wlength += TRANSPORT.size_short; // sqlType
- wlength += TRANSPORT.size_int; // metadataId
- wlength += TRANSPORT.size_bytes(fkCatalogNmBytes, true);
- wlength += TRANSPORT.size_bytes(fkSchemaNmBytes, true);
- wlength += TRANSPORT.size_bytes(fkTableNmBytes, true);
-
- buf = new LogicalByteArray(wlength, Header.sizeOf(), ic.getByteSwap());
-
- buf.insertInt(dialogueId);
- buf.insertString(stmtLabelBytes);
- buf.insertShort(APIType);
- buf.insertString(catalogNmBytes, true);
- buf.insertString(schemaNmBytes, true);
- buf.insertString(tableNmBytes, true);
- buf.insertString(tableTypeListBytes, true);
- buf.insertString(columnNmBytes, true);
- buf.insertInt(columnType);
- buf.insertInt(rowIdScope);
- buf.insertInt(nullable);
- buf.insertInt(uniqueness);
- buf.insertInt(accuracy);
- buf.insertShort(sqlType);
- buf.insertInt(metadataId);
- buf.insertString(fkCatalogNmBytes, true);
- buf.insertString(fkSchemaNmBytes, true);
- buf.insertString(fkTableNmBytes, true);
-
- return buf;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/72e17019/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsReply.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsReply.java b/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsReply.java
deleted file mode 100644
index 9736d47..0000000
--- a/core/conn/jdbc_type4/src/org/trafodion/jdbc/t4/GetSQLCatalogsReply.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// @@@ START COPYRIGHT @@@
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-// @@@ END COPYRIGHT @@@
-
-package org.trafodion.jdbc.t4;
-
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.UnsupportedCharsetException;
-import java.sql.SQLException;
-
-class GetSQLCatalogsReply {
- odbc_SQLSvc_GetSQLCatalogs_exc_ m_p1;
- String m_p2;
- SQLItemDescList_def m_p3;
- ERROR_DESC_LIST_def m_p4;
- String proxySyntax = "";
-
- // -------------------------------------------------------------
- GetSQLCatalogsReply(LogicalByteArray buf, String addr, InterfaceConnection ic) throws CharacterCodingException,
- UnsupportedCharsetException, SQLException {
- buf.setLocation(Header.sizeOf());
-
- m_p1 = new odbc_SQLSvc_GetSQLCatalogs_exc_();
- m_p1.extractFromByteArray(buf, addr, ic);
-
- if (m_p1.exception_nr == TRANSPORT.CEE_SUCCESS) {
- m_p2 = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
-
- m_p3 = new SQLItemDescList_def(buf, true, ic);
-
- m_p4 = new ERROR_DESC_LIST_def();
- m_p4.extractFromByteArray(buf, ic);
-
- proxySyntax = ic.decodeBytes(buf.extractString(), InterfaceUtilities.SQLCHARSETCODE_UTF8);
- }
- }
-}