AMashenkov commented on a change in pull request #284: URL: https://github.com/apache/ignite-3/pull/284#discussion_r700091913
########## File path: modules/client/src/main/java/org/apache/ignite/jdbc/JdbcStatement.java ########## @@ -0,0 +1,647 @@ +/* + * 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. + */ + +package org.apache.ignite.jdbc; + +import java.sql.BatchUpdateException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.sql.SQLWarning; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import org.apache.ignite.client.proto.query.IgniteQueryErrorCode; +import org.apache.ignite.client.proto.query.SqlStateCode; +import org.apache.ignite.client.proto.query.event.JdbcBatchExecuteRequest; +import org.apache.ignite.client.proto.query.event.JdbcBatchExecuteResult; +import org.apache.ignite.client.proto.query.event.JdbcQuery; +import org.apache.ignite.client.proto.query.event.JdbcQueryExecuteRequest; +import org.apache.ignite.client.proto.query.event.JdbcQueryExecuteResult; +import org.apache.ignite.client.proto.query.event.JdbcQuerySingleResult; +import org.apache.ignite.client.proto.query.event.JdbcResponse; +import org.apache.ignite.internal.util.ArrayUtils; +import org.apache.ignite.internal.util.CollectionUtils; + +import static java.sql.ResultSet.CONCUR_READ_ONLY; +import static java.sql.ResultSet.FETCH_FORWARD; +import static java.sql.ResultSet.TYPE_FORWARD_ONLY; + +/** + * Jdbc statement implementation. + */ +public class JdbcStatement implements Statement { + /** Default queryPage size. */ + private static final int DFLT_PAGE_SIZE = 1024; + + /** JDBC Connection implementation. */ + private final JdbcConnection conn; + + /** Result set holdability. */ + private final int resHoldability; + + /** Schema name. */ + private final String schema; + + /** Closed flag. */ + private volatile boolean closed; + + /** Query timeout. */ + private int timeout; + + /** Explicit timeout ({@code true} is the timeout is set explicitly for the query. Otherwise {@code false}). */ + boolean explicitTimeout; + + /** Rows limit. */ + private int maxRows; + + /** Fetch size. */ + private int pageSize = DFLT_PAGE_SIZE; + + /** Result sets. */ + protected volatile List<JdbcResultSet> resSets; + + /** Batch size to keep track of number of items to return as fake update counters for executeBatch. */ + protected int batchSize; + + /** Batch. */ + protected List<JdbcQuery> batch; + + /** Close on completion. */ + private boolean closeOnCompletion; + + /** Current result index. */ + protected int curRes; + + /** + * Creates new statement. + * + * @param conn JDBC connection. + * @param resHoldability Result set holdability. + * @param schema Schema name. + */ + JdbcStatement(JdbcConnection conn, int resHoldability, String schema) { + assert conn != null; + + this.conn = conn; + this.resHoldability = resHoldability; + this.schema = schema; + } + + /** {@inheritDoc} */ + @Override public ResultSet executeQuery(String sql) throws SQLException { + execute0(sql, null); Review comment: ```suggestion execute0(Objects.requireNotNull(sql), null); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org