[ 
https://issues.apache.org/jira/browse/TRAFODION-2957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16449087#comment-16449087
 ] 

ASF GitHub Bot commented on TRAFODION-2957:
-------------------------------------------

Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1535#discussion_r183574234
  
    --- 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 --
    
    What happens if there is ';' in the character literal of the sql query?


> T4JDBC should support compound statement
> ----------------------------------------
>
>                 Key: TRAFODION-2957
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2957
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: liu ming
>            Assignee: mashengchen
>            Priority: Major
>
> should be able to run multiple statements in one JDBC call.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to