diff --git a/core/conn/jdbcT4/src/main/java/T4Messages.properties b/core/conn/jdbcT4/src/main/java/T4Messages.properties index 3b2e6616fe..85f6410eb5 100644 --- a/core/conn/jdbcT4/src/main/java/T4Messages.properties +++ b/core/conn/jdbcT4/src/main/java/T4Messages.properties @@ -706,4 +706,52 @@ cursor_after_last_row_sqlcode=29190 unable_unwrap_msg=The interface is not unable to wrap. unable_unwrap_sqlstate=HY109 -unable_unwrap_sqlcode=29190 +unable_unwrap_sqlcode=29191 + +prepared_statement_close_failed_msg=prepared statement close failed, you can use getNextException() for more details +prepared_statement_close_failed_sqlstate=HY000 +prepared_statement_close_failed_sqlcode=29192 + +prepared_statement_close_failed_msg=prepared statement cancel failed, you can use getNextException() for more details +prepared_statement_close_failed_sqlstate=HY000 +prepared_statement_close_failed_sqlcode=29193 + +execute_not_supported_msg=execute(sql) not supported in preparedStatement +execute_not_supported_sqlstate=HY000 +execute_not_supported_sqlcode=29194 + +execute_2_not_supported_msg=execute(sql, autoGeneratedKeys) not supported in preparedStatement +execute_2_not_supported_sqlstate=HY000 +execute_2_not_supported_sqlcode=29195 + +execute_3_not_supported_msg=execute(sql, columnIndexes) not supported in preparedStatement +execute_3_not_supported_sqlstate=HY000 +execute_3_not_supported_sqlcode=29196 + +execute_4_not_supported_msg=execute(sql, columnNames) not supported in preparedStatement +execute_4_not_supported_sqlstate=HY000 +execute_4_not_supported_sqlcode=29197 + +executeQuery_not_supported_msg=executeQuery(sql) not supported in preparedStatement +executeQuery_not_supported_sqlstate=HY000 +executeQuery_not_supported_sqlcode=29198 + +addBatch_not_supported_msg=addBatch(sql) not supported in preparedStatement +addBatch_not_supported_sqlstate=HY000 +addBatch_not_supported_sqlcode=29199 + +executeUpdate_not_supported_msg=executeUpdate(sql) not supported in preparedStatement +executeUpdate_not_supported_sqlstate=HY000 +executeUpdate_not_supported_sqlcode=29200 + +executeUpdate_2_not_supported_msg=executeUpdate(sql, autoGeneratedKeys) not supported in preparedStatement +executeUpdate_2_not_supported_sqlstate=HY000 +executeUpdate_2_not_supported_sqlcode=29201 + +executeUpdate_3_not_supported_msg=executeUpdate(sql, columnIndexes) not supported in preparedStatement +executeUpdate_3_not_supported_sqlstate=HY000 +executeUpdate_3_not_supported_sqlcode=29202 + +executeUpdate_4_not_supported_msg=executeUpdate(sql, columnNames) not supported in preparedStatement +executeUpdate_4_not_supported_sqlstate=HY000 +executeUpdate_4_not_supported_sqlcode=29203 \ No newline at end of file diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4LoggingUtilities.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4LoggingUtilities.java index e29da5e31c..b86317267a 100644 --- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4LoggingUtilities.java +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4LoggingUtilities.java @@ -21,6 +21,9 @@ package org.trafodion.jdbc.t4; +import java.util.logging.Level; +import java.util.logging.Logger; + public class T4LoggingUtilities { static final Long m_syncL = new Long(1L); @@ -77,740 +80,758 @@ static Object[] makeParams(T4Properties t4props) { } // end makeParams // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, boolean b1) { - Object obj[] = new Object[2]; - - obj[0] = t4props; - obj[1] = Boolean.toString(b1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1) { - Object obj[] = new Object[2]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1) { - Object obj[] = new Object[2]; - - obj[0] = t4props; - obj[1] = obj1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, long l1) { - Object obj[] = new Object[2]; - - obj[0] = t4props; - obj[1] = Long.toString(l1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, int i2) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, int i1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, Object obj1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = obj1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, boolean b1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Boolean.toString(b1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, double d1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Double.toString(d1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, boolean b1, boolean b2) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Boolean.toString(b1); - obj[2] = Boolean.toString(b2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, boolean b1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Boolean.toString(b1); +// static Object[] makeParams(T4Properties t4props, boolean b1) { +// Object obj[] = new Object[2]; +// +// obj[0] = t4props; +// obj[1] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1) { +// Object obj[] = new Object[2]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1) { +// Object obj[] = new Object[2]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, long l1) { +// Object obj[] = new Object[2]; +// +// obj[0] = t4props; +// obj[1] = Long.toString(l1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, int i2) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, int i1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, Object obj1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = obj1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, boolean b1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, double d1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Double.toString(d1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, boolean b1, boolean b2) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Boolean.toString(b1); +// obj[2] = Boolean.toString(b2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, boolean b1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, short s1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Short.toString(s1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, double d1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Double.toString(d1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, long l1, int i1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Long.toString(l1); +// obj[2] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, long l1, Object o1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = Long.toString(l1); +// obj[2] = o1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, long l1) { +// Object obj[] = new Object[3]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Long.toString(l1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, int i1, int i2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Integer.toString(i1); +// obj[3] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, Object obj1, int i2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = obj1; +// obj[3] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, Object obj1, Object obj2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = obj1; +// obj[3] = obj2; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, int i2, Object obj1) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Integer.toString(i2); +// obj[3] = obj1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, int i2, int i3) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Integer.toString(i2); +// obj[3] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, int i1, Object o2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Integer.toString(i1); +// obj[3] = o2; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, int i1) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object[] oa1, int i1, Object o1) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = oa1; +// obj[2] = Integer.toString(i1); +// obj[3] = o1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = Long.toString(l1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, long l1, Object o2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Long.toString(l1); +// obj[3] = o2; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, boolean b1, Object o2) { +// Object obj[] = new Object[4]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Boolean.toString(b1); +// obj[3] = o2; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, Object obj1, int i2, int i3) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = obj1; +// obj[3] = Integer.toString(i2); +// obj[4] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, int i1, int i2, int i3) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Integer.toString(i1); +// obj[3] = Integer.toString(i2); +// obj[4] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, int i1, long l1, Object obj2) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Integer.toString(i1); +// obj[3] = Long.toString(l1); +// obj[4] = obj1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, int i1) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = obj3; +// obj[4] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, Object[] oa1, int i2, Object o1) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = oa1; +// obj[3] = Integer.toString(i2); +// obj[4] = o1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, Object o4) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// obj[4] = o4; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, int i1, boolean b1, int i2) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Integer.toString(i1); +// obj[3] = Boolean.toString(b1); +// obj[4] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, int i1, Object o3) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = Integer.toString(i1); +// obj[4] = o3; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, long l1, Object o1, int i1, int i2) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = Long.toString(l1); +// obj[2] = o1; +// obj[3] = Integer.toString(i1); +// obj[4] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1, Object o3) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = Long.toString(l1); +// obj[4] = o3; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2, int i3) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Integer.toString(i2); +// obj[5] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, int i1, int i2) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = obj3; +// obj[4] = Integer.toString(i1); +// obj[5] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, boolean b1, Object obj3, Object obj4) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Boolean.toString(b1); +// obj[4] = obj3; +// obj[5] = obj4; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, boolean b1, int i2) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Boolean.toString(b1); +// obj[5] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, int i2, Object[] oa1, int i3, Object o1) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Integer.toString(i2); +// obj[3] = oa1; +// obj[4] = Integer.toString(i3); +// obj[5] = o1; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, long l1, Object obj3) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Long.toString(l1); +// obj[5] = obj3; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, int i1, boolean b1) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// ; +// obj[4] = Integer.toString(i1); +// obj[5] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, boolean b1, boolean b2) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// ; +// obj[4] = Boolean.toString(b1); +// obj[5] = Boolean.toString(b2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, int i1, int i2, Object o1, int i3, boolean b1) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = Integer.toString(i1); +// obj[2] = Integer.toString(i2); +// obj[3] = o1; +// obj[4] = Integer.toString(i3); +// obj[5] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1, Object o3, int i1) { +// Object obj[] = new Object[6]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = Long.toString(l1); +// obj[4] = o3; +// obj[5] = Integer.toString(i1); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, int i1, long l1, Object obj2, int i2, int i3) { +// Object obj[] = new Object[7]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = Integer.toString(i1); +// obj[3] = Long.toString(l1); +// obj[4] = obj2; +// obj[5] = Integer.toString(i2); +// obj[6] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) { +// Object obj[] = new Object[7]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// obj[4] = o4; +// obj[5] = o5; +// obj[6] = o6; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, long l1, Object obj3, +// boolean b1, int i2) { +// Object obj[] = new Object[8]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Long.toString(l1); +// obj[5] = obj3; +// obj[6] = Boolean.toString(b1); +// obj[7] = Integer.toString(i2); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, boolean b1, int i1, int i2, +// Object obj4, int i3) { +// Object obj[] = new Object[9]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = obj3; +// obj[4] = Boolean.toString(b1); +// obj[5] = Integer.toString(i1); +// obj[6] = Integer.toString(i2); +// obj[7] = obj4; +// obj[8] = Integer.toString(i3); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2, int i3, int i4, int i5, +// int i6) +// +// { +// Object obj[] = new Object[9]; +// +// obj[0] = t4props; +// obj[1] = obj1; +// obj[2] = obj2; +// obj[3] = Integer.toString(i1); +// obj[4] = Integer.toString(i2); +// obj[5] = Integer.toString(i3); +// obj[6] = Integer.toString(i4); +// obj[7] = Integer.toString(i5); +// obj[8] = Integer.toString(i6); +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, short s1, Object o2, Object o3, Object o4, Object o5, +// Object o6, int i1, int i2, long l1, int i3, int i4, short s2, int i5, Object o7, Object o8, Object o9) { +// Object obj[] = new Object[18]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = Short.toString(s1); +// obj[3] = o2; +// obj[4] = o3; +// obj[5] = o4; +// obj[6] = o5; +// obj[7] = o6; +// obj[8] = Integer.toString(i1); +// obj[9] = Integer.toString(i2); +// obj[10] = Long.toString(l1); +// obj[11] = Integer.toString(i3); +// obj[12] = Integer.toString(i4); +// obj[13] = Short.toString(s2); +// obj[14] = Integer.toString(i5); +// obj[15] = o7; +// obj[16] = o8; +// obj[17] = o9; +// +// return obj; +// } // end makeParams +// +// // ---------------------------------------------------------- +// static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, boolean b1) { +// Object obj[] = new Object[5]; +// +// obj[0] = t4props; +// obj[1] = o1; +// obj[2] = o2; +// obj[3] = o3; +// obj[4] = Boolean.toString(b1); +// +// return obj; +// } // end makeParams - return obj; - } // end makeParams + // ---------------------------------------------------------- + static Object[] makeParams(T4Properties t4props, Object... obj) { - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, short s1) { - Object obj[] = new Object[3]; + Object newObj[] = new Object[obj == null ? 0 : obj.length + 1]; - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Short.toString(s1); + newObj[0] = t4props; + for (int i = 0; i < obj.length; i++) { + newObj[i + 1] = obj[i]; + } - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, double d1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Double.toString(d1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, long l1, int i1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Long.toString(l1); - obj[2] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, long l1, Object o1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = Long.toString(l1); - obj[2] = o1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, long l1) { - Object obj[] = new Object[3]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Long.toString(l1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, int i1, int i2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Integer.toString(i1); - obj[3] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, Object obj1, int i2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = obj1; - obj[3] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, Object obj1, Object obj2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = obj1; - obj[3] = obj2; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, int i2, Object obj1) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Integer.toString(i2); - obj[3] = obj1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, int i2, int i3) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Integer.toString(i2); - obj[3] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, int i1, Object o2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Integer.toString(i1); - obj[3] = o2; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, int i1) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object[] oa1, int i1, Object o1) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = oa1; - obj[2] = Integer.toString(i1); - obj[3] = o1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = Long.toString(l1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, long l1, Object o2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Long.toString(l1); - obj[3] = o2; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, boolean b1, Object o2) { - Object obj[] = new Object[4]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Boolean.toString(b1); - obj[3] = o2; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, Object obj1, int i2, int i3) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = obj1; - obj[3] = Integer.toString(i2); - obj[4] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, int i1, int i2, int i3) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Integer.toString(i1); - obj[3] = Integer.toString(i2); - obj[4] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, int i1, long l1, Object obj2) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Integer.toString(i1); - obj[3] = Long.toString(l1); - obj[4] = obj1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, int i1) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = obj3; - obj[4] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, Object[] oa1, int i2, Object o1) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = oa1; - obj[3] = Integer.toString(i2); - obj[4] = o1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, Object o4) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - obj[4] = o4; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, int i1, boolean b1, int i2) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Integer.toString(i1); - obj[3] = Boolean.toString(b1); - obj[4] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, int i1, Object o3) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = Integer.toString(i1); - obj[4] = o3; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, long l1, Object o1, int i1, int i2) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = Long.toString(l1); - obj[2] = o1; - obj[3] = Integer.toString(i1); - obj[4] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1, Object o3) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = Long.toString(l1); - obj[4] = o3; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2, int i3) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Integer.toString(i2); - obj[5] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, int i1, int i2) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = obj3; - obj[4] = Integer.toString(i1); - obj[5] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, boolean b1, Object obj3, Object obj4) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Boolean.toString(b1); - obj[4] = obj3; - obj[5] = obj4; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, boolean b1, int i2) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Boolean.toString(b1); - obj[5] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, int i2, Object[] oa1, int i3, Object o1) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Integer.toString(i2); - obj[3] = oa1; - obj[4] = Integer.toString(i3); - obj[5] = o1; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, long l1, Object obj3) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Long.toString(l1); - obj[5] = obj3; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, int i1, boolean b1) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - ; - obj[4] = Integer.toString(i1); - obj[5] = Boolean.toString(b1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, boolean b1, boolean b2) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - ; - obj[4] = Boolean.toString(b1); - obj[5] = Boolean.toString(b2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, int i1, int i2, Object o1, int i3, boolean b1) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = Integer.toString(i1); - obj[2] = Integer.toString(i2); - obj[3] = o1; - obj[4] = Integer.toString(i3); - obj[5] = Boolean.toString(b1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, long l1, Object o3, int i1) { - Object obj[] = new Object[6]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = Long.toString(l1); - obj[4] = o3; - obj[5] = Integer.toString(i1); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, int i1, long l1, Object obj2, int i2, int i3) { - Object obj[] = new Object[7]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = Integer.toString(i1); - obj[3] = Long.toString(l1); - obj[4] = obj2; - obj[5] = Integer.toString(i2); - obj[6] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) { - Object obj[] = new Object[7]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - obj[4] = o4; - obj[5] = o5; - obj[6] = o6; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, long l1, Object obj3, - boolean b1, int i2) { - Object obj[] = new Object[8]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Long.toString(l1); - obj[5] = obj3; - obj[6] = Boolean.toString(b1); - obj[7] = Integer.toString(i2); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, Object obj3, boolean b1, int i1, int i2, - Object obj4, int i3) { - Object obj[] = new Object[9]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = obj3; - obj[4] = Boolean.toString(b1); - obj[5] = Integer.toString(i1); - obj[6] = Integer.toString(i2); - obj[7] = obj4; - obj[8] = Integer.toString(i3); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object obj1, Object obj2, int i1, int i2, int i3, int i4, int i5, - int i6) - - { - Object obj[] = new Object[9]; - - obj[0] = t4props; - obj[1] = obj1; - obj[2] = obj2; - obj[3] = Integer.toString(i1); - obj[4] = Integer.toString(i2); - obj[5] = Integer.toString(i3); - obj[6] = Integer.toString(i4); - obj[7] = Integer.toString(i5); - obj[8] = Integer.toString(i6); - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, short s1, Object o2, Object o3, Object o4, Object o5, - Object o6, int i1, int i2, long l1, int i3, int i4, short s2, int i5, Object o7, Object o8, Object o9) { - Object obj[] = new Object[18]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = Short.toString(s1); - obj[3] = o2; - obj[4] = o3; - obj[5] = o4; - obj[6] = o5; - obj[7] = o6; - obj[8] = Integer.toString(i1); - obj[9] = Integer.toString(i2); - obj[10] = Long.toString(l1); - obj[11] = Integer.toString(i3); - obj[12] = Integer.toString(i4); - obj[13] = Short.toString(s2); - obj[14] = Integer.toString(i5); - obj[15] = o7; - obj[16] = o8; - obj[17] = o9; - - return obj; - } // end makeParams - - // ---------------------------------------------------------- - static Object[] makeParams(T4Properties t4props, Object o1, Object o2, Object o3, boolean b1) { - Object obj[] = new Object[5]; - - obj[0] = t4props; - obj[1] = o1; - obj[2] = o2; - obj[3] = o3; - obj[4] = Boolean.toString(b1); - - return obj; - } // end makeParams + return newObj; + } // end makeParams + static void log(Logger logger, Level l, T4Properties t4props, String clazz, String method, String msg, Object... p) { + if (logger.isLoggable(l) == true) { + logger.logp(l, clazz, method, msg, T4LoggingUtilities.makeParams(t4props, p)); + } + } } // end class T4LogFormatter diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java index 6c609d9c7e..4f484a0b49 100644 --- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java @@ -173,6 +173,8 @@ public class T4Properties { //TCP Nagle's algorithm private boolean _tcpNoDelay = true; + private boolean allowMultiQueries = false; + // ----------------------------------------------------------- // // The following static members and static block are ment to @@ -436,9 +438,10 @@ private void setProperties() { setLobChunkSize(getProperty("lobChunkSize")); setUseLobHandle(getProperty("useLobHandle")); + setAllowMultiQueries(getProperty("allowMultiQueries")); } - T4Properties getT4Properties() { + T4Properties getT4Properties() { return this; } @@ -532,6 +535,7 @@ public Properties getProperties() { props.setProperty("lobChunkSize", String.valueOf(lobChunkSize_)); props.setProperty("useLobHandle", String.valueOf(useLobHandle_)); + props.setProperty("allowMultiQueries", String.valueOf(allowMultiQueries)); return props; } @@ -1942,19 +1946,19 @@ public void setUseLobHandle(String val) { /** * Returns the rounding mode set for the driver as an Integer value with one - * of the following values. static int ROUND_CEILING Rounding mode to round - * towards positive infinity. static int ROUND_DOWN Rounding mode to round - * towards zero. static int ROUND_FLOOR Rounding mode to round towards - * negative infinity. static int ROUND_HALF_DOWN Rounding mode to round - * towards "nearest neighbor" unless both neighbors are equidistant, in - * which case round down. static int ROUND_HALF_EVEN Rounding mode to round - * towards the "nearest neighbor" unless both neighbors are equidistant, in - * which case, round towards the even neighbor. static int ROUND_HALF_UP - * Rounding mode to round towards "nearest neighbor" unless both neighbors - * are equidistant, in which case round up. static int ROUND_UNNECESSARY - * Rounding mode to assert that the requested operation has an exact result, - * hence no rounding is necessary. static int ROUND_UP Rounding mode to - * round away from zero. + * of the following values. + * static int ROUND_CEILING Rounding mode to round towards positive infinity. + * static int ROUND_DOWN Rounding mode to round towards zero. + * static int ROUND_FLOOR Rounding mode to round towards negative infinity. + * static int ROUND_HALF_DOWN Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, + * in which case round down. + * static int ROUND_HALF_EVEN Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, + * in which case, round towards the even neighbor. + * static int ROUND_HALF_UP Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, + * in which case round up. + * static int ROUND_UNNECESSARY Rounding mode to assert that the requested operation has an exact result, + * hence no rounding is necessary. + * static int ROUND_UP Rounding mode to round away from zero. */ int getRoundingMode() { return roundMode_; @@ -2571,6 +2575,20 @@ void setClientInfoProperties(Properties prop) { Properties getClientInfoProperties() { return this.clientInfoProp; } - - + + public boolean isAllowMultiQueries() { + return allowMultiQueries; + } + + public void setAllowMultiQueries(boolean allowMultiQueries) { + this.allowMultiQueries = allowMultiQueries; + } + + private void setAllowMultiQueries(String property) { + if (property != null && property.length()>0){ + setAllowMultiQueries(Boolean.valueOf(property)); + }else{ + setAllowMultiQueries(false); + } + } } diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java index ce7c980c67..1320fdf15c 100644 --- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java @@ -183,7 +183,11 @@ public Statement createStatement() throws SQLException { validateConnection(); try { - return new TrafT4Statement(this); + if (props_.isAllowMultiQueries()) { + return new TrafT4MultiQueriesStatement(this); + } else { + return new TrafT4Statement(this); + } } catch (SQLException se) { performConnectionErrorChecks(se); throw se; @@ -774,9 +778,12 @@ public PreparedStatement prepareStatement(String sql) throws SQLException { } } - stmt = new TrafT4PreparedStatement(this, sql); - - stmt.prepare(stmt.sql_, stmt.queryTimeout_, stmt.resultSetHoldability_); + if (props_.isAllowMultiQueries()) { + stmt = new TrafT4MultiQueriesPreparedStatement(this, sql); + } else { + stmt = new TrafT4PreparedStatement(this, sql); + stmt.prepare(stmt.sql_, stmt.queryTimeout_, stmt.resultSetHoldability_); + } if (isStatementCachingEnabled()) { addPreparedStatement(this, sql, stmt, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesPreparedStatement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesPreparedStatement.java new file mode 100644 index 0000000000..678d28cdd8 --- /dev/null +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesPreparedStatement.java @@ -0,0 +1,754 @@ +// @@@ 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.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.BatchUpdateException; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +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.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.logging.Level; + +public class TrafT4MultiQueriesPreparedStatement extends TrafT4PreparedStatement { + + private String[] sqlArr = null; + private TrafT4PreparedStatement[] pstmtArr = null; + private int[][] paramDescs = null; + + private int currentSqlIndex; + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql) throws SQLException { + this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "", "", sql); + } + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql, String stmtLabel) throws SQLException { + this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, stmtLabel); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "", "", sql, stmtLabel); + } + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + this(connection, sql, resultSetType, resultSetConcurrency, connection.holdability_, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "", "", connection, sql, resultSetType, + resultSetConcurrency); + } + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) throws SQLException { + this(connection, sql, resultSetType, resultSetConcurrency, resultSetHoldability, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "", "", connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + } + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability, String stmtLabel) throws SQLException { + super(connection, sql, resultSetType, resultSetConcurrency, resultSetHoldability, stmtLabel); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "", "", connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability, stmtLabel); + + if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE + && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_type", null); + } + if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_concurrency", null); + } + if ((resultSetHoldability != 0) && (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) + && (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT)) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_holdability", + null); + } + + sqlArr = sql.split(";"); + pstmtArr = new TrafT4PreparedStatement[sqlArr.length]; + paramDescs = new int[sqlArr.length][3]; + int total = 0; + int currentParamsLen = 0; + for (int i = 0; i < sqlArr.length; i++) { + pstmtArr[i] = new TrafT4PreparedStatement(connection, sqlArr[i], resultSetType, resultSetConcurrency, + resultSetHoldability, stmtLabel); + pstmtArr[i].prepare(sqlArr[i], queryTimeout_, resultSetHoldability_); + + // this is to setup the paramDescs, each paramDesc has 3 column, + // 1: index of preparedStatement + // 2: num of params for current pstmt + // 3: accumulated params for current index + // this varible is used when there invoking setXXX api + if (pstmtArr[i].inputDesc_ != null) { + currentParamsLen = pstmtArr[i].inputDesc_.length; + total += currentParamsLen; + } + int[] paramDesc = { i, currentParamsLen, total }; + paramDescs[i] = paramDesc; + + } + } + + // this method will return a 2 column array. + // first column means the index of preparedStatement + // second column means the real parameter index of the column one preparedStatement + // eg: + // insert into tbl values (?,?);insert into tbl values (?,?,?);insert into tbl values (?,?) + // the paramDescs is {0,2,2},{1,3,5},{2,2,7} , when use setXXX(6, x); + // there will return {2,1} , means set param for the 1st param of the 3rd sql. + private int[] getCurrentParamIndex(int paramIndex) { + if (paramIndex < 1 || paramIndex > paramDescs[paramDescs.length - 1][2]) { + return new int[] { 0, paramIndex }; + } + for (int i = 0; i < paramDescs.length; i++) { + if (paramIndex > paramDescs[i][2]) { + continue; + } else { + int index = paramIndex - (paramDescs[i][2] - paramDescs[i][1]); + return new int[] { i, index }; + } + } + + return new int[] { 0, paramIndex }; + + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setArray", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setArray(paramIndex[1], x); + } + + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setAsciiStream", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setAsciiStream(paramIndex[1], x); + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setAsciiStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setAsciiStream(paramIndex[1], x); + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setAsciiStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setAsciiStream(paramIndex[1], x); + }; + + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBigDecimal", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBigDecimal(paramIndex[1], x); + } + + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBinaryStream", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBinaryStream(paramIndex[1], x); + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBinaryStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBinaryStream(paramIndex[1], x, length); + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBinaryStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBinaryStream(paramIndex[1], x, length); + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBlob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBlob(paramIndex[1], x); + } + + public void setBlob(int parameterIndex, InputStream x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBlob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBlob(paramIndex[1], x); + } + + public void setBlob(int parameterIndex, InputStream x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBlob", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBlob(paramIndex[1], x, length); + }; + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBoolean", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBoolean(paramIndex[1], x); + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setByte", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setByte(paramIndex[1], x); + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setBytes", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setBytes(paramIndex[1], x); + } + + public void setCharacterStream(int parameterIndex, Reader x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setCharacterStream", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setCharacterStream(paramIndex[1], x); + } + + public void setCharacterStream(int parameterIndex, Reader x, int length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setCharacterStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setCharacterStream(paramIndex[1], x, length); + } + + public void setCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setCharacterStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setCharacterStream(paramIndex[1], x, length); + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setClob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setClob(paramIndex[1], x); + } + + public void setClob(int parameterIndex, Reader x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setClob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setClob(paramIndex[1], x); + } + + public void setClob(int parameterIndex, Reader x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setClob", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setClob(paramIndex[1], x, length); + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setDate", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setDate(paramIndex[1], x); + } + + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setDate", "", parameterIndex, x, cal); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setDate(paramIndex[1], x, cal); + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setDouble", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setDouble(paramIndex[1], x); + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setFloat", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setFloat(paramIndex[1], x); + } + + public void setInt(int parameterIndex, int x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setInt", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setInt(paramIndex[1], x); + } + + public void setLong(int parameterIndex, long x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setLong", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setLong(paramIndex[1], x); + } + + public void setNCharacterStream(int parameterIndex, Reader x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNCharacterStream", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNCharacterStream(paramIndex[1], x); + } + + public void setNCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNCharacterStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNCharacterStream(paramIndex[1], x, length); + } + + public void setNClob(int parameterIndex, NClob x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNClob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNClob(paramIndex[1], x); + } + + public void setNClob(int parameterIndex, Reader x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNClob", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNClob(paramIndex[1], x); + } + + public void setNClob(int parameterIndex, Reader x, long length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNClob", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNClob(paramIndex[1], x, length); + } + + public void setNString(int parameterIndex, String x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNString", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNString(paramIndex[1], x); + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNull", "", parameterIndex, sqlType); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNull(paramIndex[1], sqlType); + } + + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setNull", "", parameterIndex, sqlType, typeName); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setNull(paramIndex[1], sqlType, typeName); + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setObject", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setObject(paramIndex[1], x); + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setObject", "", parameterIndex, x, targetSqlType); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setObject(paramIndex[1], x, targetSqlType); + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setObject", "", parameterIndex, x, targetSqlType, scale); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setObject(paramIndex[1], x, targetSqlType, scale); + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setRef", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setRef(paramIndex[1], x); + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setRowId", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setRowId(paramIndex[1], x); + } + + public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setSQLXML", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setSQLXML(paramIndex[1], x); + } + + public void setShort(int parameterIndex, short x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setShort", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setShort(paramIndex[1], x); + } + + public void setString(int parameterIndex, String x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setString", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setString(paramIndex[1], x); + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setTime", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setTime(paramIndex[1], x); + } + + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setTime", "", parameterIndex, x, cal); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setTime(paramIndex[1], x, cal); + } + + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setTimestamp", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setTimestamp(paramIndex[1], x); + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setTimestamp", "", parameterIndex, x, cal); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setTimestamp(paramIndex[1], x, cal); + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setUnicodeStream", "", parameterIndex, x, length); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setUnicodeStream(paramIndex[1], x, length); + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "setURL", "", parameterIndex, x); + int[] paramIndex = getCurrentParamIndex(parameterIndex); + pstmtArr[paramIndex[0]].setURL(paramIndex[1], x); + } + + public void addBatch() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "addBatch", ""); + for (int i = 0; i < pstmtArr.length; i++) { + pstmtArr[i].addBatch(); + } + } + + public int[] executeBatch() throws SQLException, BatchUpdateException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getUpdateCount", ""); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4MultiQueriesPreparedStatement", "executeBatch", "", p); + } + currentSqlIndex = 0; + + int[] results = null; + for (int i = 0; i < pstmtArr.length; i++) { + int[] result = pstmtArr[i].executeBatch(); + if (results == null) { + results = result; + } else { + int[] tmp = new int[results.length + result.length]; + System.arraycopy(results, 0, tmp, 0, results.length); + System.arraycopy(result, 0, tmp, results.length, result.length); + results = tmp; + } + } + + return results; + } + + public int getUpdateCount() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getUpdateCount", ""); + long result = 0; + currentSqlIndex = 0; + + for (int i = 0; i < pstmtArr.length; i++) { + result += pstmtArr[i].getUpdateCount(); + } + return (int) result; + } + + // TODO here may add some logic in TrafT4ResultSet + public ResultSet executeQuery() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeQuery", ""); + ResultSet[] results = new ResultSet[pstmtArr.length]; + currentSqlIndex = 0; + + for (int i = 0; i < pstmtArr.length; i++) { + results[i] = pstmtArr[i].executeQuery(); + } + return results[currentSqlIndex++]; + } + + public boolean execute() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getParameterMetaData", ""); + boolean result = false; + currentSqlIndex = 0; + + for (int i = 0; i < pstmtArr.length; i++) { + result |= pstmtArr[i].execute(); + } + return result; + } + + public int executeUpdate() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeUpdate", ""); + long result = 0; + currentSqlIndex = 0; + + for (int i = 0; i < pstmtArr.length; i++) { + result += pstmtArr[i].executeUpdate(); + } + return (int) result; + } + + public ResultSetMetaData getMetaData() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getMetaData", ""); + return pstmtArr[0].getMetaData(); + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getParameterMetaData", ""); + return pstmtArr[0].getParameterMetaData(); + } + + public ResultSet getResultSet() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "getResultSet", ""); + return pstmtArr[0].getResultSet(); + } + + public void close() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "close", ""); + if (pstmtArr == null) { + return; + } + SQLException[] eArr = new SQLException[pstmtArr.length]; + boolean hasException = false; + int exceptionNum = 0; + for (int i = 0; i < pstmtArr.length; i++) { + try { + pstmtArr[i].close(); + } catch (SQLException e) { + hasException = true; + exceptionNum++; + eArr[i] = e; + } + } + if (hasException) { + if (exceptionNum > 1) { + TrafT4Exception t4e = TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "prepared_statement_close_failed", null); + SQLException sqlE = t4e; + SQLException tmpE = null; + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + if (tmpE == null) { + sqlE.setNextException(eArr[i]); + tmpE = eArr[i]; + } else { + tmpE.setNextException(eArr[i]); + tmpE = eArr[i]; + } + } + } + throw sqlE; + } else { + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + throw eArr[i]; + } + } + } + } + } + + public void cancel() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "cancel", ""); + if (pstmtArr == null) { + return; + } + SQLException[] eArr = new SQLException[pstmtArr.length]; + boolean hasException = false; + int exceptionNum = 0; + for (int i = 0; i < pstmtArr.length; i++) { + try { + pstmtArr[i].cancel(); + } catch (SQLException e) { + hasException = true; + exceptionNum++; + eArr[i] = e; + } + } + + if (hasException) { + if (exceptionNum > 1) { + TrafT4Exception t4e = TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "prepared_statement_cancel_failed", null); + SQLException sqlE = t4e; + SQLException tmpE = null; + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + if (tmpE == null) { + sqlE.setNextException(eArr[i]); + tmpE = eArr[i]; + } else { + tmpE.setNextException(eArr[i]); + tmpE = eArr[i]; + } + } + } + throw sqlE; + } else { + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + throw eArr[i]; + } + } + } + } + } + + public void addBatch(String sql) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "addBatch", "", sql); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "addBatch_not_supported", null); + } + + public boolean execute(String sql) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "execute", "", sql); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "execute_not_supported", null); + } + + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "execute", "", sql, autoGeneratedKeys); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "execute_2_not_supported", null); + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "execute", "", sql, columnIndexes); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "execute_3_not_supported", null); + } + + public boolean execute(String sql, String[] columnNames) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "execute", "", sql, columnNames); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "execute_4_not_supported", null); + } + + public ResultSet executeQuery(String sql) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeQuery", "", sql); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "executeQuery_not_supported", null); + } + + public int executeUpdate(String sql) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeUpdate", "", sql); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "executeUpdate_not_supported", null); + } + + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeUpdate", "", sql, autoGeneratedKeys); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "executeUpdate_2_not_supported", null); + } + + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeUpdate", "", sql, columnIndexes); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "executeUpdate_3_not_supported", null); + } + + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesPreparedStatement", "executeUpdate", "", sql, columnNames); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.props_.getLocale(), + "executeUpdate_4_not_supported", null); + } + +} diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesStatement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesStatement.java new file mode 100644 index 0000000000..af0df494be --- /dev/null +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesStatement.java @@ -0,0 +1,220 @@ +// @@@ 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.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; + +public class TrafT4MultiQueriesStatement extends TrafT4Statement { + + private String[] sqlArr = null; + private Statement[] stmtArr = null; + private TrafT4Connection conn = null; + private int resultSetType; + private int resultSetConcurrency; + private int resultSetHoldability; + private String stmtLabel = null; + private int currentSqlIndex; + + TrafT4MultiQueriesStatement(TrafT4Connection connection) throws SQLException { + this(connection, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "", "", connection); + } + + TrafT4MultiQueriesStatement(TrafT4Connection connection, String stmtLabel) throws SQLException { + this(connection, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, stmtLabel); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "", "", connection, stmtLabel); + } + + TrafT4MultiQueriesStatement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency) + throws SQLException { + this(connection, resultSetType, resultSetConcurrency, TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "", "", connection, resultSetType, resultSetConcurrency); + } + + TrafT4MultiQueriesStatement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException { + this(connection, resultSetType, resultSetConcurrency, resultSetHoldability, null); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "", "", connection, resultSetType, resultSetConcurrency, + resultSetHoldability); + } + + TrafT4MultiQueriesStatement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency, + int resultSetHoldability, String stmtLabel) throws SQLException { + super(connection, resultSetType, resultSetConcurrency, resultSetHoldability, stmtLabel); + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "", "", connection, resultSetType, resultSetConcurrency, + resultSetHoldability, stmtLabel); + + if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE + && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_type", null); + } + if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_concurrency", null); + } + if ((resultSetHoldability != 0) && (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) + && (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT)) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_holdability", + null); + } + + this.conn = connection; + this.resultSetType = resultSetType; + this.resultSetConcurrency = resultSetConcurrency; + this.resultSetHoldability = resultSetHoldability; + this.stmtLabel = stmtLabel; + } + + public boolean execute(String sql) throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "execute", "", sql); + sqlArr = sql.split(";"); + stmtArr = new Statement[sqlArr.length]; + + boolean result = false; + for (int i = 0; i < sqlArr.length; i++) { + stmtArr[i] = new TrafT4Statement(conn, resultSetType, resultSetConcurrency, resultSetHoldability, stmtLabel); + result |= stmtArr[i].execute(sqlArr[i]); + } + return result; + } + + public ResultSet getResultSet() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "getResultSet", ""); + return stmtArr[currentSqlIndex].getResultSet(); + } + + public boolean getMoreResults() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "getMoreResults", ""); + if (currentSqlIndex++ >= (sqlArr.length - 1)) { + return false; + } + return true; + } + + public void close() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "close", ""); + if (stmtArr == null) { + return; + } + SQLException[] eArr = new SQLException[stmtArr.length]; + boolean hasException = false; + int exceptionNum = 0; + for (int i = 0; i < stmtArr.length; i++) { + try { + stmtArr[i].close(); + } catch (SQLException e) { + hasException = true; + exceptionNum++; + eArr[i] = e; + } + } + if (hasException) { + if (exceptionNum > 1) { + TrafT4Exception t4e = TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "prepared_statement_close_failed", null); + SQLException sqlE = t4e; + SQLException tmpE = null; + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + if (tmpE == null) { + sqlE.setNextException(eArr[i]); + tmpE = eArr[i]; + } else { + tmpE.setNextException(eArr[i]); + tmpE = eArr[i]; + } + } + } + throw sqlE; + } else { + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + throw eArr[i]; + } + } + } + } + } + + public void cancel() throws SQLException { + T4LoggingUtilities.log(connection_.props_.t4Logger_, Level.FINE, connection_.props_, + "TrafT4MultiQueriesStatement", "cancel", ""); + if (stmtArr == null) { + return; + } + SQLException[] eArr = new SQLException[stmtArr.length]; + boolean hasException = false; + int exceptionNum = 0; + for (int i = 0; i < stmtArr.length; i++) { + try { + stmtArr[i].cancel(); + } catch (SQLException e) { + hasException = true; + exceptionNum++; + eArr[i] = e; + } + } + + if (hasException) { + if (exceptionNum > 1) { + TrafT4Exception t4e = TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "prepared_statement_cancel_failed", null); + SQLException sqlE = t4e; + SQLException tmpE = null; + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + if (tmpE == null) { + sqlE.setNextException(eArr[i]); + tmpE = eArr[i]; + } else { + tmpE.setNextException(eArr[i]); + tmpE = eArr[i]; + } + } + } + throw sqlE; + } else { + for (int i = 0; i < eArr.length; i++) { + if (eArr[i] != null) { + throw eArr[i]; + } + } + } + } + } + +} diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java index 0016510c43..5e3530f8a1 100644 --- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4PreparedStatement.java @@ -2067,150 +2067,134 @@ public void close(boolean hardClose) throws SQLException { } + public TrafT4PreparedStatement() { + if (T4Properties.t4GlobalLogger.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(null); + T4Properties.t4GlobalLogger.logp(Level.FINE, "TrafT4PreparedStatement", "", "", p); + } + } + + TrafT4PreparedStatement(TrafT4Connection connection, String sql, String stmtLabel) throws SQLException { + this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.holdability_, + stmtLabel); + connection.ic_.t4props_.setUseArrayBinding(false); + connection.ic_.t4props_.setBatchRecovery(false); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, stmtLabel); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", + "Note, this call is before previous constructor call.", p); + } + if (connection_.props_.getLogWriter() != null) { + LogRecord lr = new LogRecord(Level.FINE, ""); + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); + lr.setParameters(p); + lr.setSourceClassName("TrafT4PreparedStatement"); + lr.setSourceMethodName(""); + T4LogFormatter lf = new T4LogFormatter(); + String temp = lf.format(lr); + connection_.props_.getLogWriter().println(temp); + } + } + + // Constructors with access specifier as "default" + TrafT4PreparedStatement(TrafT4Connection connection, String sql) throws SQLException { + this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.holdability_, null); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", + "Note, this call is before previous constructor call.", p); + } + if (connection_.props_.getLogWriter() != null) { + LogRecord lr = new LogRecord(Level.FINE, ""); + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); + lr.setParameters(p); + lr.setSourceClassName("TrafT4PreparedStatement"); + lr.setSourceMethodName(""); + T4LogFormatter lf = new T4LogFormatter(); + String temp = lf.format(lr); + connection_.props_.getLogWriter().println(temp); + } + } + + TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency) + throws SQLException { + this(connection, sql, resultSetType, resultSetConcurrency, connection.holdability_, null); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", + "Note, this call is before previous constructor call.", p); + } + if (connection_.props_.getLogWriter() != null) { + LogRecord lr = new LogRecord(Level.FINE, ""); + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency); + lr.setParameters(p); + lr.setSourceClassName("TrafT4PreparedStatement"); + lr.setSourceMethodName(""); + T4LogFormatter lf = new T4LogFormatter(); + String temp = lf.format(lr); + connection_.props_.getLogWriter().println(temp); + } + } + + TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException { + this(connection, sql, resultSetType, resultSetConcurrency, resultSetHoldability, null); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", + "Note, this call is before previous constructor call.", p); + } + if (connection_.props_.getLogWriter() != null) { + LogRecord lr = new LogRecord(Level.FINE, ""); + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + lr.setParameters(p); + lr.setSourceClassName("TrafT4PreparedStatement"); + lr.setSourceMethodName(""); + T4LogFormatter lf = new T4LogFormatter(); + String temp = lf.format(lr); + connection_.props_.getLogWriter().println(temp); + } + } + + TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability, String stmtLabel) throws SQLException { + super(connection, resultSetType, resultSetConcurrency, resultSetHoldability, stmtLabel); + if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability, stmtLabel); + connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", + "Note, this call is before previous constructor call.", p); + } + if (connection_.props_.getLogWriter() != null) { + LogRecord lr = new LogRecord(Level.FINE, ""); + Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + lr.setParameters(p); + lr.setSourceClassName("TrafT4PreparedStatement"); + lr.setSourceMethodName(""); + T4LogFormatter lf = new T4LogFormatter(); + String temp = lf.format(lr); + connection_.props_.getLogWriter().println(temp); + } + // connection_.getServerHandle().isConnectionOpen(); + connection_.isConnectionOpen(); + sqlStmtType_ = ist_.getSqlStmtType(sql); + if (sqlStmtType_ == TRANSPORT.TYPE_STATS) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "infostats_invalid_error", null); + } else if (sqlStmtType_ == TRANSPORT.TYPE_CONFIG) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "config_cmd_invalid_error", null); + } + ist_.setTransactionStatus(connection_, sql); + sql_ = sql; - TrafT4PreparedStatement(TrafT4Connection connection, String sql, String stmtLabel) throws SQLException { - this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.holdability_, - stmtLabel); - connection.ic_.t4props_.setUseArrayBinding(false); - connection.ic_.t4props_.setBatchRecovery(false); - if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); - connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", - "Note, this call is before previous constructor call.", p); - } - if (connection_.props_.getLogWriter() != null) { - LogRecord lr = new LogRecord(Level.FINE, ""); - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); - lr.setParameters(p); - lr.setSourceClassName("TrafT4PreparedStatement"); - lr.setSourceMethodName(""); - T4LogFormatter lf = new T4LogFormatter(); - String temp = lf.format(lr); - connection_.props_.getLogWriter().println(temp); - } - } - - // Constructors with access specifier as "default" - TrafT4PreparedStatement(TrafT4Connection connection, String sql) throws SQLException { - this(connection, sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, connection.holdability_); - if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); - connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", - "Note, this call is before previous constructor call.", p); - } - if (connection_.props_.getLogWriter() != null) { - LogRecord lr = new LogRecord(Level.FINE, ""); - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql); - lr.setParameters(p); - lr.setSourceClassName("TrafT4PreparedStatement"); - lr.setSourceMethodName(""); - T4LogFormatter lf = new T4LogFormatter(); - String temp = lf.format(lr); - connection_.props_.getLogWriter().println(temp); - } - } - - TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency) - throws SQLException { - this(connection, sql, resultSetType, resultSetConcurrency, connection.holdability_); - if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency); - connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", - "Note, this call is before previous constructor call.", p); - } - if (connection_.props_.getLogWriter() != null) { - LogRecord lr = new LogRecord(Level.FINE, ""); - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency); - lr.setParameters(p); - lr.setSourceClassName("TrafT4PreparedStatement"); - lr.setSourceMethodName(""); - T4LogFormatter lf = new T4LogFormatter(); - String temp = lf.format(lr); - connection_.props_.getLogWriter().println(temp); - } - - } - TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency, - int resultSetHoldability, String stmtLabel) throws SQLException { - super(connection, resultSetType, resultSetConcurrency, resultSetHoldability, stmtLabel); - if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", - "Note, this call is before previous constructor call.", p); - } - if (connection_.props_.getLogWriter() != null) { - LogRecord lr = new LogRecord(Level.FINE, ""); - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - lr.setParameters(p); - lr.setSourceClassName("TrafT4PreparedStatement"); - lr.setSourceMethodName(""); - T4LogFormatter lf = new T4LogFormatter(); - String temp = lf.format(lr); - connection_.props_.getLogWriter().println(temp); - } - // connection_.getServerHandle().isConnectionOpen(); - connection_.isConnectionOpen(); - sqlStmtType_ = ist_.getSqlStmtType(sql); - if (sqlStmtType_ == TRANSPORT.TYPE_STATS) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "infostats_invalid_error", null); - } else if (sqlStmtType_ == TRANSPORT.TYPE_CONFIG) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "config_cmd_invalid_error", null); - } - ist_.setTransactionStatus(connection_, sql); - sql_ = sql; - - - // stmtLabel_ = generateStmtLabel(); - stmtLabel_ = stmtLabel; - // System.out.println("TrafT4PreparedStatement stmtLabel_ " + stmtLabel_); - - usingRawRowset_ = false; - } - - TrafT4PreparedStatement(TrafT4Connection connection, String sql, int resultSetType, int resultSetConcurrency, - int resultSetHoldability) throws SQLException { - super(connection, resultSetType, resultSetConcurrency, resultSetHoldability); - if (connection_.props_.t4Logger_.isLoggable(Level.FINE) == true) { - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - connection_.props_.t4Logger_.logp(Level.FINE, "TrafT4PreparedStatement", "", - "Note, this call is before previous constructor call.", p); - } - if (connection_.props_.getLogWriter() != null) { - LogRecord lr = new LogRecord(Level.FINE, ""); - Object p[] = T4LoggingUtilities.makeParams(connection_.props_, connection, sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - lr.setParameters(p); - lr.setSourceClassName("TrafT4PreparedStatement"); - lr.setSourceMethodName(""); - T4LogFormatter lf = new T4LogFormatter(); - String temp = lf.format(lr); - connection_.props_.getLogWriter().println(temp); - } - // connection_.getServerHandle().isConnectionOpen(); - connection_.isConnectionOpen(); - sqlStmtType_ = ist_.getSqlStmtType(sql); - if (sqlStmtType_ == TRANSPORT.TYPE_STATS) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "infostats_invalid_error", null); - } else if (sqlStmtType_ == TRANSPORT.TYPE_CONFIG) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "config_cmd_invalid_error", null); - } - ist_.setTransactionStatus(connection_, sql); - sql_ = sql; - - - //stmtLabel_ = generateStmtLabel(); - - usingRawRowset_ = false; - } + usingRawRowset_ = false; + } TrafT4PreparedStatement(TrafT4Connection connection, String moduleName, int moduleVersion, long moduleTimestamp, String stmtName, boolean isSelect, int holdability) { @@ -2249,7 +2233,6 @@ public void close(boolean hardClose) throws SQLException { queryTimeout_ = connection_.getServerHandle().getQueryTimeout(); resultSetType_ = ResultSet.TYPE_FORWARD_ONLY; resultSetHoldability_ = holdability; - usingRawRowset_ = false; } // Interface methods diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java index cda76d68bb..8405f19e08 100644 --- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java +++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Statement.java @@ -349,9 +349,7 @@ public int[] executeBatch() throws SQLException, BatchUpdateException { validateExecDirectInvocation(); if ((batchCommands_ == null) || (batchCommands_.isEmpty())) { - return new int[] - - {}; + return new int[] {}; } for (i = 0; i < batchCommands_.size(); i++) { @@ -1299,7 +1297,9 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St * * For closing statements using label. */ TrafT4Statement(TrafT4Connection connection, String stmtLabel) throws SQLException { - if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { + this(connection, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, stmtLabel); + if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection, stmtLabel); connection.props_.t4Logger_.logp(Level.FINE, "TrafT4Statement", "", "", p); } @@ -1313,31 +1313,12 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St String temp = lf.format(lr); connection.props_.getLogWriter().println(temp); } - int hashcode; - - connection_ = connection; - operationID_ = -1; - - resultSetType_ = ResultSet.TYPE_FORWARD_ONLY; - resultSetConcurrency_ = ResultSet.CONCUR_READ_ONLY; - resultSetHoldability_ = TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT; - queryTimeout_ = connection_.getServerHandle().getQueryTimeout(); - - stmtLabel_ = stmtLabel; - fetchSize_ = TrafT4ResultSet.DEFAULT_FETCH_SIZE; - maxRows_ = 0; - fetchDirection_ = ResultSet.FETCH_FORWARD; - pRef_ = new WeakReference(this, connection_.refStmtQ_); - ist_ = new InterfaceStatement(this); - connection_.addElement(pRef_, stmtLabel_); - - resultSet_ = new TrafT4ResultSet[1]; - initResultSets(); } TrafT4Statement(TrafT4Connection connection) throws SQLException { - this(connection, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT); - if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { + this(connection, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, + TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, null); + if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection); connection.props_.t4Logger_.logp(Level.FINE, "TrafT4Statement", "", "Note, this constructor was called before the previous constructor", p); @@ -1352,13 +1333,10 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St String temp = lf.format(lr); connection.props_.getLogWriter().println(temp); } - resultSet_ = new TrafT4ResultSet[1]; - roundingMode_ = connection_.props_.getRoundingMode(); - initResultSets(); } TrafT4Statement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency) throws SQLException { - this(connection, resultSetType, resultSetConcurrency, TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT); + this(connection, resultSetType, resultSetConcurrency, TrafT4ResultSet.CLOSE_CURSORS_AT_COMMIT, null); if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection, resultSetType, resultSetConcurrency); @@ -1376,9 +1354,6 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St String temp = lf.format(lr); connection.props_.getLogWriter().println(temp); } - resultSet_ = new TrafT4ResultSet[1]; - roundingMode_ = connection_.props_.getRoundingMode(); - initResultSets(); } TrafT4Statement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency, int resultSetHoldability, String stmtLabel) throws SQLException { @@ -1398,40 +1373,40 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St String temp = lf.format(lr); connection.props_.getLogWriter().println(temp); } - int hashcode; - - connection_ = connection; - operationID_ = -1; - if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE - && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "invalid_resultset_type", null); - } - - if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) { - resultSetType_ = ResultSet.TYPE_SCROLL_INSENSITIVE; - connection_.setSQLWarning(null, "scrollResultSetChanged", null); - //setSQLWarning(null, "scrollResultSetChanged", null); - } else { - resultSetType_ = resultSetType; + && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_type", null); } if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "invalid_resultset_concurrency", null); + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), + "invalid_resultset_concurrency", null); } - if ((resultSetHoldability != 0) && (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) - && (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT)) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_holdability", - null); + && (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT)) { + throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_holdability", + null); + } + + if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) { + resultSetType_ = ResultSet.TYPE_SCROLL_INSENSITIVE; + connection_.setSQLWarning(null, "scrollResultSetChanged", null); + //setSQLWarning(null, "scrollResultSetChanged", null); + } else { + resultSetType_ = resultSetType; } + connection_ = connection; + operationID_ = -1; resultSetConcurrency_ = resultSetConcurrency; resultSetHoldability_ = resultSetHoldability; queryTimeout_ = connection_.getServerHandle().getQueryTimeout(); - stmtLabel_ = stmtLabel; + if (stmtLabel == null || stmtLabel.length() == 0) { + stmtLabel_ = generateStmtLabel(); + } else { + stmtLabel_ = stmtLabel; + } fetchSize_ = TrafT4ResultSet.DEFAULT_FETCH_SIZE; maxRows_ = 0; fetchDirection_ = ResultSet.FETCH_FORWARD; @@ -1443,11 +1418,15 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St roundingMode_ = connection_.props_.getRoundingMode(); resultSet_ = new TrafT4ResultSet[1]; + if (stmtLabel == null || stmtLabel.length() == 0) { + initResultSets(); + } } TrafT4Statement(TrafT4Connection connection, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { - if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { + this(connection, resultSetType, resultSetConcurrency, resultSetHoldability, null); + if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection, resultSetType, resultSetConcurrency, resultSetHoldability); connection.props_.t4Logger_.logp(Level.FINE, "TrafT4Statement", "", "", p); @@ -1463,52 +1442,6 @@ void setExecute2Outputs(byte[] values, short rowsAffected, boolean endOfData, St String temp = lf.format(lr); connection.props_.getLogWriter().println(temp); } - int hashcode; - - connection_ = connection; - operationID_ = -1; - - if (resultSetType != ResultSet.TYPE_FORWARD_ONLY && resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE - && resultSetType != ResultSet.TYPE_SCROLL_SENSITIVE) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "invalid_resultset_type", null); - } - - if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) { - resultSetType_ = ResultSet.TYPE_SCROLL_INSENSITIVE; - connection_.setSQLWarning(null, "scrollResultSetChanged", null); - //setSQLWarning(null, "scrollResultSetChanged", null); - } else { - resultSetType_ = resultSetType; - } - if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY && resultSetConcurrency != ResultSet.CONCUR_UPDATABLE) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), - "invalid_resultset_concurrency", null); - } - - if ((resultSetHoldability != 0) && (resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) - && (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT)) { - throw TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(), "invalid_holdability", - null); - } - - resultSetConcurrency_ = resultSetConcurrency; - resultSetHoldability_ = resultSetHoldability; - queryTimeout_ = connection_.getServerHandle().getQueryTimeout(); - - stmtLabel_ = generateStmtLabel(); - fetchSize_ = TrafT4ResultSet.DEFAULT_FETCH_SIZE; - maxRows_ = 0; - fetchDirection_ = ResultSet.FETCH_FORWARD; - - connection_.gcStmts(); - pRef_ = new WeakReference(this, connection_.refStmtQ_); - ist_ = new InterfaceStatement(this); - connection_.addElement(pRef_, stmtLabel_); - - resultSet_ = new TrafT4ResultSet[1]; - roundingMode_ = connection_.props_.getRoundingMode(); - initResultSets(); } //max length for a label is 32 characters.