Github user selvaganesang commented on a diff in the pull request: https://github.com/apache/trafodion/pull/1535#discussion_r185934375 --- Diff: core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4MultiQueriesPreparedStatement.java --- @@ -0,0 +1,372 @@ +package org.trafodion.jdbc.t4; + +import java.math.BigDecimal; +import java.sql.BatchUpdateException; +import java.sql.Date; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +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); + if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection, sql); + connection.props_.t4Logger_.logp(Level.FINE, "TrafT4MultiQueriesPreparedStatement", "<init>", "", p); + } + } + + 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); + if (connection.props_.t4Logger_.isLoggable(Level.FINE) == true) { + Object p[] = T4LoggingUtilities.makeParams(connection.props_, connection, sql, stmtLabel); + connection.props_.t4Logger_.logp(Level.FINE, "TrafT4MultiQueriesPreparedStatement", "<init>", "", p); + } + } + + TrafT4MultiQueriesPreparedStatement(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, "TrafT4MultiQueriesPreparedStatement", "<init>", "", p); + } + } + + TrafT4MultiQueriesPreparedStatement(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, "TrafT4MultiQueriesPreparedStatement", "<init>", "", p); + } + + } + + TrafT4MultiQueriesPreparedStatement(TrafT4Connection connection, String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability, String stmtLabel) throws SQLException { + super(connection, sql, 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, "TrafT4MultiQueriesPreparedStatement", "<init>", "", p); + } + + 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(";"); --- End diff -- I agree with you @mashengchen. But my suggestion is to take care of ';' when it appears in the midst of string literal in the param. Do you think if that suggestion would hold good? If so, do you think it is better to make that change
---