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:12:00 UTC
[21/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/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
new file mode 100644
index 0000000..c181bee
--- /dev/null
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
@@ -0,0 +1,5389 @@
+// @@@ 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.io.InputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URL;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.UnsupportedCharsetException;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DataTruncation;
+import java.sql.DatabaseMetaData;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Calendar;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+public class TrafT4ResultSet extends HPT4Handle implements java.sql.ResultSet {
+
+ // java.sql.ResultSet interface methods
+ public boolean absolute(int row) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, row);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "absolute", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, row);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("absolute");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ boolean flag = false;
+ int absRow;
+
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "forward_only_cursor",
+ null);
+ }
+ if (row == 0) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_row_number",
+ null);
+ }
+
+
+ if (row > 0) {
+ if (row <= numRows_) {
+ currentRow_ = row;
+ isBeforeFirst_ = false;
+ isAfterLast_ = false;
+ onInsertRow_ = false;
+ flag = true;
+ } else {
+ do {
+ flag = next();
+ if (!flag) {
+ break;
+ }
+ } while (currentRow_ < row);
+ }
+ } else {
+ absRow = -row;
+ afterLast();
+ if (absRow <= numRows_) {
+ currentRow_ = numRows_ - absRow + 1;
+ isAfterLast_ = false;
+ isBeforeFirst_ = false;
+ onInsertRow_ = false;
+ flag = true;
+ } else {
+ beforeFirst();
+ }
+ }
+ return flag;
+ }
+
+ public void afterLast() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "afterLast", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("afterLast");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "forward_only_cursor",
+ null);
+ }
+ last();
+ // currentRow_++;
+ isAfterLast_ = true;
+ isBeforeFirst_ = false;
+ }
+
+ public void beforeFirst() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "beforeFirst", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("beforeFirst");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "forward_only_cursor",
+ null);
+ }
+
+
+ currentRow_ = 0;
+ isBeforeFirst_ = true;
+ isAfterLast_ = false;
+ onInsertRow_ = false;
+ }
+
+ public void cancelRowUpdates() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "cancelRowUpdates", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("cancelRowUpdates");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
+ throw HPT4Messages
+ .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
+ }
+ if (onInsertRow_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cursor_position", null);
+ }
+ Row row = (Row) getCurrentRow();
+ if (!row.getUpdated()) {
+ row.clearUpdated();
+ }
+ }
+
+ /**
+ * Close the resultSet. This method is synchronized to prevent many threads
+ * talking to the same server after close().
+ *
+ * @throws SQLException
+ */
+ synchronized public void close() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "close", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("close");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+ if (isClosed_) {
+ return;
+ }
+ if (connection_._isClosed()) {
+ connection_.closeErroredConnection(null);
+ return;
+ }
+
+
+ if (stmt_ instanceof org.trafodion.jdbc.t4.TrafT4PreparedStatement) {
+ close(false);
+ } else {
+ close(true);
+ }
+ }
+
+ public void deleteRow() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "deleteRow", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("deleteRow");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
+ throw HPT4Messages
+ .createSQLException(connection_.props_, connection_.getLocale(), "read_only_concur", null);
+ }
+ if (onInsertRow_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cursor_position", null);
+ }
+
+
+ try {
+ prepareDeleteStmt();
+ Row row = (Row) getCurrentRow();
+ // Remove the row from database
+ row.deleteRow(connection_.getLocale(), deleteStmt_, paramCols_);
+ // Remove the row from the resultSet
+ cachedRows_.remove(--currentRow_);
+ --numRows_;
+
+ if ((getType() == ResultSet.TYPE_FORWARD_ONLY) && (getConcurrency() == ResultSet.CONCUR_UPDATABLE)) {
+ int temp;
+ temp = currentRowCount_;
+
+ if (!next()) {
+ if (temp == 1) {
+ isBeforeFirst_ = true;
+ }
+ currentRowCount_ = 0;
+ } else {
+ --currentRowCount_;
+ }
+ } else {
+ if (currentRow_ == 0) {
+ isBeforeFirst_ = true;
+ }
+ }
+ } catch (SQLException e) {
+ performConnectionErrorChecks(e);
+ throw e;
+ }
+ }
+
+ public int findColumn(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "findColumn", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("findColumn");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int i;
+
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ for (i = 0; i < outputDesc_.length; i++) {
+ if (columnName.equalsIgnoreCase(outputDesc_[i].name_)) {
+ return i + 1;
+ }
+ }
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_column_name", null);
+ }
+
+ public boolean first() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "first", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("first");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ boolean flag = true;
+
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "forward_only_cursor",
+ null);
+ }
+
+
+ if (isBeforeFirst_) {
+ flag = next();
+ }
+ if (numRows_ > 0) {
+ currentRow_ = 1;
+ isAfterLast_ = false;
+ isBeforeFirst_ = false;
+ onInsertRow_ = false;
+ }
+ return flag;
+ }
+
+ // JDK 1.2
+ public Array getArray(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getArray", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getArray");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ validateGetInvocation(columnIndex);
+ HPT4Messages.throwUnsupportedFeatureException(connection_.props_, connection_.getLocale(), "getArray()");
+ return null;
+ }
+
+ // JDK 1.2
+ public Array getArray(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getArray", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getArray");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getArray(columnIndex);
+ }
+
+ public InputStream getAsciiStream(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getAsciiStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getAsciiStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ // For LOB Support - SB 10/8/2004
+ int dataType;
+
+
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ switch (dataType) {
+
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ return new java.io.DataInputStream(new java.io.ByteArrayInputStream(data.getBytes("ASCII")));
+ } catch (java.io.UnsupportedEncodingException e) {
+ Object[] messageArguments = new Object[1];
+ messageArguments[0] = e.getMessage();
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "unsupported_encoding", messageArguments);
+ }
+ } else {
+ return null;
+ }
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+
+ }
+
+ public InputStream getAsciiStream(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getAsciiStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getAsciiStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getAsciiStream(columnIndex);
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBigDecimal", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBigDecimal");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int dataType;
+
+ String data;
+ BigDecimal retValue;
+ Double d;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ // String returned may not be numeric in case of SQL_CHAR, SQL_VARCHAR
+ // and SQL_LONGVARCHAR
+ // fields. Hoping that java might throw invalid value exception
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ data = data.trim();
+ try {
+ retValue = new BigDecimal(data);
+ } catch (NumberFormatException e) {
+ try {
+ d = new Double(data);
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ retValue = new BigDecimal(d.doubleValue());
+ }
+ return retValue;
+ } else {
+ return null;
+ }
+ }
+
+ public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, scale);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBigDecimal", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, scale);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBigDecimal");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ BigDecimal retValue;
+
+ retValue = getBigDecimal(columnIndex);
+ if (retValue != null) {
+ return retValue.setScale(scale);
+ } else {
+ return null;
+ }
+ }
+
+ public BigDecimal getBigDecimal(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBigDecimal", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBigDecimal");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getBigDecimal(columnIndex);
+ }
+
+ public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, scale);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBigDecimal", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, scale);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBigDecimal");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getBigDecimal(columnIndex, scale);
+ }
+
+ public InputStream getBinaryStream(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBinaryStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBinaryStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ validateGetInvocation(columnIndex);
+ byte[] data;
+
+ // For LOB Support - SB 10/8/2004
+ int dataType;
+
+
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ switch (dataType) {
+
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = getBytes(columnIndex);
+ if (data != null) {
+ return new java.io.ByteArrayInputStream(data);
+ } else {
+ return null;
+ }
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+ }
+
+ public InputStream getBinaryStream(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBinaryStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBinaryStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getBinaryStream(columnIndex);
+ }
+
+
+ public boolean getBoolean(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBoolean", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBoolean");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ short shortValue;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ data = data.trim();
+ if ((data.equalsIgnoreCase("true")) || (data.equalsIgnoreCase("1"))) {
+ return true;
+ } else if ((data.equalsIgnoreCase("false")) || (data.equalsIgnoreCase("false"))) {
+ return false;
+ } else {
+ try {
+ shortValue = getShort(columnIndex);
+ } catch (NumberFormatException e) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ switch (shortValue) {
+ case 0:
+ return false;
+ case 1:
+ return true;
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public boolean getBoolean(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBoolean", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBoolean");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getBoolean(columnIndex);
+ }
+
+ public byte getByte(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getByte", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getByte");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ byte retValue;
+ Double d;
+ double d1;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ retValue = Byte.parseByte(data);
+ } catch (NumberFormatException e) {
+ try {
+ d = new Double(data);
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ d1 = d.doubleValue();
+ // To allow -128.999.. and 127.999...
+ if (d1 > (double) Byte.MIN_VALUE - 1 && d1 < (double) Byte.MAX_VALUE + 1) {
+ retValue = d.byteValue();
+ if ((double) retValue != d1) {
+ setSQLWarning(null, "data_truncation", null);
+ }
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ }
+ return retValue;
+ } else {
+ return 0;
+ }
+ }
+
+ public byte getByte(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getByte", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getByte");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getByte(columnIndex);
+ }
+
+ public byte[] getBytes(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBytes", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBytes");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ validateGetInvocation(columnIndex);
+ int dataType;
+
+
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+
+ switch (dataType) {
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ case Types.CHAR:
+ case Types.VARCHAR: // Extension allows varchar and
+ case Types.LONGVARCHAR: // longvarchar data types
+ case Types.BLOB:
+ case Types.CLOB:
+
+ Object x = getCurrentRow().getColumnObject(columnIndex);
+ if (x == null) {
+ wasNull_ = true;
+ return null;
+ } else {
+ wasNull_ = false;
+ if (x instanceof byte[]) {
+ return (byte[]) x;
+ } else if (x instanceof String) {
+ return ((String) x).getBytes();
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ }
+
+
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+ }
+
+ public byte[] getBytes(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getBytes", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getBytes");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getBytes(columnIndex);
+ }
+
+ public Reader getCharacterStream(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getCharacterStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getCharacterStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ int dataType;
+
+
+ validateGetInvocation(columnIndex);
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ switch (dataType) {
+
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BINARY:
+ case Types.VARBINARY:
+ case Types.LONGVARBINARY:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = getString(columnIndex);
+ if (data != null) {
+ return new java.io.StringReader(data);
+ } else {
+ return null;
+ }
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+
+ }
+
+ public Reader getCharacterStream(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getCharacterStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getCharacterStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getCharacterStream(columnIndex);
+ }
+
+ public int getConcurrency() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getConcurrency", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getConcurrency");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (stmt_ != null) {
+ return stmt_.resultSetConcurrency_;
+ } else {
+ return ResultSet.CONCUR_READ_ONLY;
+ }
+ }
+
+ public String getCursorName() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getCursorName", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getCursorName");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (spj_rs_ && stmtLabel_ != null) {
+ return stmtLabel_;
+ } else if (stmt_ != null) {
+ String cursorName;
+ cursorName = stmt_.cursorName_;
+ if (cursorName == null) {
+ cursorName = stmt_.stmtLabel_;
+ }
+ return cursorName;
+ } else {
+ return null;
+ }
+ }
+
+ // wm_merge - AM
+ static String convertDateFormat(String dt) {
+ String tokens[] = dt.split("[/]", 3);
+
+ if (tokens.length != 3) {
+ return dt;
+ }
+ StringBuffer sb = new StringBuffer();
+ sb.append(tokens[0]).append("-").append(tokens[1]).append("-").append(tokens[2]);
+ return sb.toString();
+ }
+
+ public Date getDate(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDate", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDate");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int dataType;
+ String data;
+ Date retValue;
+ int endIndex;
+
+ validateGetInvocation(columnIndex);
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ if (dataType != Types.CHAR && dataType != Types.VARCHAR && dataType != Types.LONGVARCHAR
+ && dataType != Types.DATE && dataType != Types.TIMESTAMP) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ boolean convertDate = connection_.getDateConversion();
+
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINEST) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ String temp = "Convert Date=" + convertDate;
+ connection_.props_.t4Logger_.logp(Level.FINEST, "TrafT4ResultSet", "getDate", temp, p);
+ }
+ if (convertDate) {
+ String dt = convertDateFormat(data);
+ retValue = valueOf(dt);
+ } else {
+ retValue = Date.valueOf(data);
+ }
+ } catch (IllegalArgumentException e) {
+ data = data.trim();
+ if ((endIndex = data.indexOf(' ')) != -1) {
+ data = data.substring(0, endIndex);
+ }
+ try {
+ retValue = Date.valueOf(data);
+ setSQLWarning(null, "data_truncation", null);
+
+ } catch (IllegalArgumentException ex) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ }
+ return retValue;
+ } else {
+ return null;
+ }
+ }
+
+ /* TODO: this is a horrible hack but what else can be done with random 2 digit/4 digit years for dates?
+ * Note: The date constructor wants (year-1900) as a parameter
+ * We use the following table for conversion:
+ *
+ * Year Value Assumed Year Action
+ * <50 Value + 2000 must add 100
+ * >=100 Value must subtract 1900
+ * >=50 Value + 1900 no change in value needed
+ *
+ */
+ static Date valueOf(String s) {
+ int year;
+ int month;
+ int day;
+ int firstDash;
+ int secondDash;
+
+ if (s == null)
+ throw new java.lang.IllegalArgumentException();
+
+ firstDash = s.indexOf('-');
+ secondDash = s.indexOf('-', firstDash + 1);
+ if ((firstDash > 0) & (secondDash > 0) & (secondDash < s.length() - 1)) {
+ year = Integer.parseInt(s.substring(0, firstDash));
+
+ if (year < 50) {//handles 2 digit years: <50 assume 2000, >=50 assume 1900
+ year += 100;
+ }
+ else if(year >= 100) { //handles 4 digit years
+ year -= 1900;
+ }
+
+ month = Integer.parseInt(s.substring(firstDash + 1, secondDash)) - 1;
+ day = Integer.parseInt(s.substring(secondDash + 1));
+ } else {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ return new Date(year, month, day);
+ }
+
+ public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDate", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDate");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ Date sqlDate;
+ java.util.Date d;
+
+ sqlDate = getDate(columnIndex);
+ if (sqlDate != null) {
+ if (cal != null) {
+ cal.setTime(sqlDate);
+ d = cal.getTime();
+ sqlDate = new Date(d.getTime());
+ }
+ return sqlDate;
+ } else {
+ return (sqlDate);
+ }
+ }
+
+ public Date getDate(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDate", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDate");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getDate(columnIndex);
+ }
+
+ public Date getDate(String columnName, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDate", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDate");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getDate(columnIndex, cal);
+ }
+
+ public double getDouble(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDouble", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDouble");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ return Double.parseDouble(data);
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public double getDouble(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getDouble", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getDouble");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getDouble(columnIndex);
+ }
+
+ public int getFetchDirection() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getFetchDirection", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getFetchDirection");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ return fetchDirection_;
+ }
+
+ public int getFetchSize() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getFetchSize", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getFetchSize");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ return fetchSize_;
+ }
+
+ public float getFloat(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getFloat", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getFloat");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ double data;
+ validateGetInvocation(columnIndex);
+
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ // parseFloat doesn't return error when
+ // the value exceds the float max
+ data = getDouble(columnIndex);
+ if (data >= Float.NEGATIVE_INFINITY && data <= Float.POSITIVE_INFINITY) {
+ return (float) data;
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "numeric_out_of_range",
+ null);
+ }
+ }
+
+ public float getFloat(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getFloat", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getFloat");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getFloat(columnIndex);
+ }
+
+ public int getInt(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getInt", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getInt");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ int retValue;
+ double d;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ retValue = Integer.parseInt(data);
+ } catch (NumberFormatException e) {
+ try {
+ d = new Double(data).doubleValue();
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+
+ if (d > (double) Integer.MIN_VALUE - 1 && d < (double) Integer.MAX_VALUE + 1) {
+ retValue = (int) d;
+ if ((double) retValue != d) {
+ setSQLWarning(null, "data_truncation", null);
+ }
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ }
+ } else {
+ retValue = 0;
+ }
+
+ return retValue;
+ }
+
+ public int getInt(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getInt", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getInt");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getInt(columnIndex);
+ }
+
+ public long getLong(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getLong", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getLong");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ long retValue;
+ double d;
+
+ BigDecimal bd;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+ data = getLocalString(columnIndex);
+
+ if (data != null) {
+ try {
+ retValue = Long.parseLong(data);
+ } catch (NumberFormatException e) {
+ try {
+ bd = new BigDecimal(data);
+ retValue = bd.longValue();
+ if (bd.compareTo(BigDecimal.valueOf(Long.MAX_VALUE)) <= 0
+ && bd.compareTo(BigDecimal.valueOf(Long.MIN_VALUE)) >= 0) {
+
+ if (bd.compareTo(BigDecimal.valueOf(retValue)) != 0) {
+ setSQLWarning(null, "data_truncation", null);
+ }
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ } catch (NumberFormatException e2) {
+
+ try {
+ d = new Double(data).doubleValue();
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+
+ if (d >= Long.MIN_VALUE && d <= Long.MAX_VALUE) {
+ retValue = (long) d;
+
+ if ((double) retValue != d) {
+ setSQLWarning(null, "data_truncation", null);
+ }
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ }
+ }
+ } else {
+ retValue = 0;
+ }
+
+ return retValue;
+ }
+
+ public long getLong(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getLong", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getLong");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getLong(columnIndex);
+ }
+
+ public ResultSetMetaData getMetaData() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getMetaData", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getMetaData");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ return new HPT4ResultSetMetaData(this, outputDesc_);
+ }
+
+ public Object getObject(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getObject", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getObject");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int dataType;
+ int precision;
+ byte byteValue;
+ short shortValue;
+ int intValue;
+ long longValue;
+ float floatValue;
+ double doubleValue;
+ boolean booleanValue;
+
+ validateGetInvocation(columnIndex);
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ precision = outputDesc_[columnIndex - 1].sqlPrecision_;
+ switch (dataType) {
+ case Types.TINYINT:
+ byteValue = getByte(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Byte(byteValue);
+ }
+ case Types.SMALLINT:
+ shortValue = getShort(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Short(shortValue);
+ }
+ case Types.INTEGER:
+ intValue = getInt(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Integer(intValue);
+ }
+ case Types.BIGINT:
+ longValue = getLong(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Long(longValue);
+ }
+ case Types.REAL:
+ floatValue = getFloat(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Float(floatValue);
+ }
+ case Types.FLOAT:
+ case Types.DOUBLE:
+ doubleValue = getDouble(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Double(doubleValue);
+ }
+ case Types.DECIMAL:
+ case Types.NUMERIC:
+ return getBigDecimal(columnIndex);
+ case Types.BIT:
+ booleanValue = getBoolean(columnIndex);
+ if (wasNull_) {
+ return null;
+ } else {
+ return new Boolean(booleanValue);
+ }
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BLOB:
+ case Types.CLOB:
+ return getString(columnIndex);
+ case Types.BINARY:
+ case Types.VARBINARY:
+ return getBytes(columnIndex);
+ case Types.LONGVARBINARY:
+ return getBinaryStream(columnIndex);
+ case Types.DATE:
+ return getDate(columnIndex);
+ case Types.TIME:
+ if (precision > 0)
+ return getString(columnIndex);
+
+ return getTime(columnIndex);
+ case Types.TIMESTAMP:
+ return getTimestamp(columnIndex);
+ // For LOB Support - SB 10/8/2004
+
+
+ case Types.OTHER:
+ return getString(columnIndex);
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+ }
+
+ // JDK 1.2
+ public Object getObject(int columnIndex, Map map) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getObject", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getObject");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ validateGetInvocation(columnIndex);
+ HPT4Messages.throwUnsupportedFeatureException(connection_.props_, connection_.getLocale(), "getObject()");
+ return null;
+ }
+
+ public Object getObject(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getObject", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getObject");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getObject(columnIndex);
+ }
+
+ // JDK 1.2
+ public Object getObject(String columnName, Map map) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, map);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getObject", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, map);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getObject");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getObject(columnIndex, map);
+ }
+
+ // JDK 1.2
+ public Ref getRef(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getRef", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getRef");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ validateGetInvocation(columnIndex);
+ HPT4Messages.throwUnsupportedFeatureException(connection_.props_, connection_.getLocale(), "getRef()");
+ return null;
+ }
+
+ // JDK 1.2
+ public Ref getRef(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getRef", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getRef");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getRef(columnIndex);
+ }
+
+ public int getRow() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getRow", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getRow");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ clearWarnings();
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (isBeforeFirst_ || isAfterLast_ || onInsertRow_) {
+ return 0;
+ }
+
+ if ((getType() == ResultSet.TYPE_FORWARD_ONLY) && (getConcurrency() == ResultSet.CONCUR_UPDATABLE)) {
+ return currentRowCount_;
+ }
+ return currentRow_;
+ }
+
+ public short getShort(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getShort", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getShort");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+
+ String data;
+ short retValue;
+ double d;
+
+ validateGetInvocation(columnIndex);
+ outputDesc_[columnIndex - 1].checkValidNumericConversion(connection_.getLocale());
+
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ retValue = Short.parseShort(data);
+ } catch (NumberFormatException e) {
+ try {
+ d = new Double(data).doubleValue();
+ } catch (NumberFormatException e1) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+
+ if (d > (double) Short.MIN_VALUE - 1 && d < (double) Short.MAX_VALUE + 1) {
+ retValue = (short) d;
+ if ((double) retValue != d)
+
+ {
+ setSQLWarning(null, "data_truncation", null);
+ }
+ } else {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "numeric_out_of_range", null);
+ }
+ }
+
+ } else {
+ retValue = 0;
+ }
+
+ return retValue;
+ }
+
+ public short getShort(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getShort", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getShort");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getShort(columnIndex);
+ }
+
+ public Statement getStatement() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getStatement", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getStatement");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ return stmt_;
+ }
+
+ public String getString(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getString", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getString");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+ int targetSqlType;
+ int precision;
+ Object x;
+ BaseRow currentRow;
+
+ validateGetInvocation(columnIndex);
+ currentRow = getCurrentRow();
+ x = currentRow.getColumnObject(columnIndex);
+
+ if (x == null) {
+ wasNull_ = true;
+ return null;
+ }
+
+ wasNull_ = false;
+ targetSqlType = outputDesc_[columnIndex - 1].dataType_;
+ precision = outputDesc_[columnIndex - 1].sqlPrecision_;
+ switch (targetSqlType) {
+
+
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = getLocalString(columnIndex);
+ if (stmt_ != null && stmt_.maxFieldSize_ != 0) {
+ if (data.length() > stmt_.maxFieldSize_) {
+ data = data.substring(0, stmt_.maxFieldSize_);
+ }
+ }
+ break;
+ case Types.VARBINARY:
+ case Types.BINARY:
+ case Types.LONGVARBINARY:
+ data = String.valueOf(getBytes(columnIndex));
+ break;
+ case Types.TIMESTAMP:
+ Timestamp t = getTimestamp(columnIndex);
+ data = "" + t.getNanos();
+ int l = data.length();
+ data = t.toString();
+
+ if(precision > 0) {
+ for(int i=0;i<precision-l;i++)
+ data += '0';
+ } else {
+ data = data.substring(0,data.lastIndexOf('.'));
+ }
+
+ break;
+ case Types.TIME:
+ if (precision > 0)
+ data = x.toString();
+ else
+ data = String.valueOf(getTime(columnIndex));
+ break;
+ case Types.DATE:
+ data = String.valueOf(getDate(columnIndex));
+ break;
+ case Types.BOOLEAN:
+ data = String.valueOf(getBoolean(columnIndex));
+ break;
+ case Types.SMALLINT:
+ data = String.valueOf(getShort(columnIndex));
+ break;
+ case Types.TINYINT:
+ data = String.valueOf(getByte(columnIndex));
+ break;
+ case Types.REAL:
+ data = String.valueOf(getFloat(columnIndex));
+ break;
+ case Types.DOUBLE:
+ case Types.FLOAT:
+ data = String.valueOf(getDouble(columnIndex));
+ break;
+ case Types.DECIMAL:
+ case Types.NUMERIC:
+ BigDecimal bd = getBigDecimal(columnIndex);
+ if (_javaVersion >= 1.5) {
+ // as of Java 5.0 and above, BigDecimal.toPlainString() should be used.
+ try {
+ data = (String) _toPlainString.invoke(bd, (Object[]) null);
+ } catch (Exception e) {
+ data = bd.toString();
+ }
+ } else {
+ data = bd.toString();
+ }
+ break;
+ case Types.BIGINT:
+ data = String.valueOf(getLong(columnIndex));
+ break;
+ case Types.INTEGER:
+ data = String.valueOf(getInt(columnIndex));
+ break;
+ case Types.OTHER: {
+ if (x instanceof byte[]) {
+ try {
+ data = new String((byte[]) x, "ASCII");
+ } catch (Exception e) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "unsupported_encoding", "ASCII");
+ }
+ } else {
+ data = x.toString();
+ }
+ // only 2 supported today
+ // 1. SQLTYPECODE_INTERVAL
+ // 2. SQLTYPECODE_DATETIME
+ // Within DATETIME we check for only the SQL/MP specific data types
+ // in another switch-case statement
+ switch (outputDesc_[columnIndex - 1].fsDataType_) {
+ case InterfaceResultSet.SQLTYPECODE_INTERVAL: {
+ // if data does no start with a hyphen (representing a negative
+ // sign)
+ // then send back data without the byte that holds the hyphen
+ // Reason: for Interval data types first byte is holding either
+ // the
+ // a negative sign or if number is positive, it is just an extra
+ // space
+ data = Utility.trimRightZeros(data);
+ if (!data.startsWith(hyphen_string)) {
+ data = data.substring(1);
+ }
+ }
+ break;
+ case InterfaceResultSet.SQLTYPECODE_DATETIME: {
+ switch (outputDesc_[columnIndex - 1].sqlDatetimeCode_) {
+ case HPT4Desc.SQLDTCODE_YEAR:
+ case HPT4Desc.SQLDTCODE_YEAR_TO_MONTH:
+ case HPT4Desc.SQLDTCODE_MONTH:
+ case HPT4Desc.SQLDTCODE_MONTH_TO_DAY:
+ case HPT4Desc.SQLDTCODE_DAY:
+ case HPT4Desc.SQLDTCODE_HOUR:
+ case HPT4Desc.SQLDTCODE_HOUR_TO_MINUTE:
+ case HPT4Desc.SQLDTCODE_MINUTE:
+ case HPT4Desc.SQLDTCODE_MINUTE_TO_SECOND:
+ // case HPT4Desc.SQLDTCODE_MINUTE_TO_FRACTION:
+ case HPT4Desc.SQLDTCODE_SECOND:
+ // case HPT4Desc.SQLDTCODE_SECOND_TO_FRACTION:
+ case HPT4Desc.SQLDTCODE_YEAR_TO_HOUR:
+ case HPT4Desc.SQLDTCODE_YEAR_TO_MINUTE:
+ case HPT4Desc.SQLDTCODE_MONTH_TO_HOUR:
+ case HPT4Desc.SQLDTCODE_MONTH_TO_MINUTE:
+ case HPT4Desc.SQLDTCODE_MONTH_TO_SECOND:
+ // case HPT4Desc.SQLDTCODE_MONTH_TO_FRACTION:
+ case HPT4Desc.SQLDTCODE_DAY_TO_HOUR:
+ case HPT4Desc.SQLDTCODE_DAY_TO_MINUTE:
+ case HPT4Desc.SQLDTCODE_DAY_TO_SECOND:
+ // case HPT4Desc.SQLDTCODE_DAY_TO_FRACTION:
+ case HPT4Desc.SQLDTCODE_HOUR_TO_FRACTION:
+ break;
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "object_type_not_supported", null);
+ }
+ }
+ break;
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "object_type_not_supported", null);
+ }
+ }
+ break;
+ case Types.ARRAY:
+ case Types.BIT:
+ case Types.REF:
+ case Types.DATALINK:
+ case Types.DISTINCT:
+ case Types.JAVA_OBJECT:
+ case Types.STRUCT:
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "object_type_not_supported", null);
+ }
+ return data;
+ }
+
+ public String getString(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getString", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getString");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getString(columnIndex);
+ }
+
+ public Time getTime(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTime", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTime");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int dataType;
+ String data;
+ Time retValue;
+ Timestamp timestamp;
+
+ validateGetInvocation(columnIndex);
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ if (dataType != Types.CHAR && dataType != Types.VARCHAR && dataType != Types.LONGVARCHAR
+ && dataType != Types.TIME && dataType != Types.TIMESTAMP) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ switch (dataType) {
+ case Types.TIMESTAMP:
+ try {
+ timestamp = Timestamp.valueOf(data);
+ retValue = new Time(timestamp.getTime());
+ } catch (IllegalArgumentException e) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ break;
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = data.trim(); // Fall Thru
+ case Types.TIME:
+ try {
+ retValue = Time.valueOf(data);
+ } catch (IllegalArgumentException e) {
+ try {
+ timestamp = Timestamp.valueOf(data);
+ retValue = new Time(timestamp.getTime());
+ } catch (IllegalArgumentException ex) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ }
+ break;
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "restricted_data_type", null);
+ }
+ return retValue;
+ } else {
+ return null;
+ }
+ }
+
+ public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTime", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTime");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ Time sqlTime;
+ java.util.Date d;
+
+ sqlTime = getTime(columnIndex);
+ if (sqlTime != null) {
+ if (cal != null) {
+ cal.setTime(sqlTime);
+ d = cal.getTime();
+ sqlTime = new Time(d.getTime());
+ }
+ return sqlTime;
+ } else {
+ return (sqlTime);
+ }
+ }
+
+ public Time getTime(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTime", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTime");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getTime(columnIndex);
+ }
+
+ public Time getTime(String columnName, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTime", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTime");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getTime(columnIndex, cal);
+ }
+
+ public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTimestamp", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTimestamp");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int dataType;
+ String data;
+ Timestamp retValue;
+ Date dateValue;
+ Time timeValue;
+
+ validateGetInvocation(columnIndex);
+ dataType = outputDesc_[columnIndex - 1].dataType_;
+ if (dataType != Types.CHAR && dataType != Types.VARCHAR && dataType != Types.LONGVARCHAR
+ && dataType != Types.DATE && dataType != Types.TIME && dataType != Types.TIMESTAMP) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "restricted_data_type",
+ null);
+ }
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ switch (dataType) {
+ case Types.DATE:
+ try {
+ dateValue = Date.valueOf(data);
+ retValue = new Timestamp(dateValue.getTime());
+ } catch (IllegalArgumentException e) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+ break;
+ case Types.CHAR:
+ case Types.VARCHAR:
+ case Types.LONGVARCHAR:
+ case Types.BLOB:
+ case Types.CLOB:
+ data = data.trim();
+ case Types.TIMESTAMP:
+ case Types.TIME:
+ try {
+ retValue = Timestamp.valueOf(data);
+ } catch (IllegalArgumentException e) {
+ try {
+ dateValue = Date.valueOf(data);
+ retValue = new Timestamp(dateValue.getTime());
+ } catch (IllegalArgumentException e1) {
+ try {
+ int nano = 0;
+ if (outputDesc_[columnIndex - 1].sqlPrecision_ > 0) {
+ nano = Integer.parseInt(data.substring(data.indexOf(".") + 1));
+ nano *= Math.pow(10, 9 - outputDesc_[columnIndex - 1].sqlPrecision_);
+ data = data.substring(0, data.indexOf("."));
+ }
+
+ timeValue = Time.valueOf(data);
+ retValue = new Timestamp(timeValue.getTime());
+ retValue.setNanos(nano);
+ } catch (IllegalArgumentException e2) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "invalid_cast_specification", null);
+ }
+
+ }
+ }
+ break;
+ default:
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "restricted_data_type", null);
+ }
+ return retValue;
+ } else {
+ return null;
+ }
+ }
+
+ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTimestamp", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTimestamp");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ Timestamp sqlTimestamp;
+ java.util.Date d;
+ int nanos;
+
+ sqlTimestamp = getTimestamp(columnIndex);
+ if (sqlTimestamp != null) {
+ if (cal != null) {
+ nanos = sqlTimestamp.getNanos();
+ cal.setTime(sqlTimestamp);
+ d = cal.getTime();
+ sqlTimestamp = new Timestamp(d.getTime());
+ sqlTimestamp.setNanos(nanos);
+ }
+ return sqlTimestamp;
+ } else {
+ return (sqlTimestamp);
+ }
+ }
+
+ public Timestamp getTimestamp(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTimestamp", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTimestamp");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getTimestamp(columnIndex);
+ }
+
+ public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getTimestamp", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName, cal);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getTimestamp");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getTimestamp(columnIndex, cal);
+ }
+
+ public int getType() throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getType", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getType");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ if (isClosed_) {
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_cursor_state",
+ null);
+ }
+ if (stmt_ != null) {
+ return stmt_.resultSetType_;
+ } else {
+ return ResultSet.TYPE_FORWARD_ONLY;
+ }
+
+ }
+
+ public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getUnicodeStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getUnicodeStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ String data;
+
+ validateGetInvocation(columnIndex);
+ data = getLocalString(columnIndex);
+ if (data != null) {
+ try {
+ return new java.io.ByteArrayInputStream(data.getBytes((String) InterfaceUtilities
+ .getCharsetName(InterfaceUtilities.SQLCHARSETCODE_UNICODE)));
+ } catch (java.io.UnsupportedEncodingException e) {
+ Object[] messageArguments = new Object[1];
+ messageArguments[0] = e.getMessage();
+ throw HPT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
+ "unsupported_encoding", messageArguments);
+ }
+ } else {
+ return null;
+ }
+
+ }
+
+ public InputStream getUnicodeStream(String columnName) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4ResultSet", "getUnicodeStream", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnName);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getUnicodeStream");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+ int columnIndex = validateGetInvocation(columnName);
+ return getUnicodeStream(columnIndex);
+ }
+
+ public URL getURL(int columnIndex) throws SQLException {
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) {
+ Object p[] = T4LoggingUtilities.makeParams(connection_.props_, columnIndex);
+ conn
<TRUNCATED>