You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2022/01/11 21:43:00 UTC

[jira] [Created] (IGNITE-16268) JDBC. Validation of statement type should be done before its execution

Konstantin Orlov created IGNITE-16268:
-----------------------------------------

             Summary: JDBC. Validation of statement type should be done before its execution
                 Key: IGNITE-16268
                 URL: https://issues.apache.org/jira/browse/IGNITE-16268
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Konstantin Orlov


Currently, it's possible to execute DML statement such as INSERT, UPDATE, or DELETE with {{Statement#executeQuery}} method. The statement will be executed, and exception will be thrown after result of the execution will be received.


{code:java}
class JdbcStatement {
    public ResultSet executeQuery(String sql) throws SQLException {
        ...
        ResultSet rs = getResultSet();

        if (rs == null) {
            throw new SQLException("The query isn't SELECT query: " + sql, SqlStateCode.PARSING_EXCEPTION);
        }
        ...
    }

    public ResultSet getResultSet() throws SQLException {
        ...
        JdbcResultSet rs = resSets.get(curRes);

        if (!rs.isQuery()) {
            return null;
        }
        ...
    }
{code}


Let's validate the type of the statement before its execution. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)