<commit_before>/*
 * 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.calcite.avatica.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;
import java.util.Objects;

/**
 * All we know about a statement. Encapsulates a {@link ResultSet}.
 */
public class StatementInfo {
  private volatile Boolean relativeSupported = null;

  final Statement statement; // sometimes a PreparedStatement
  private ResultSet resultSet;
  private long position = 0;

  // True when setResultSet(ResultSet) is called to let us determine the difference between
  // a null ResultSet (from an update) from the lack of a ResultSet.
  private boolean resultsInitialized = false;

  public StatementInfo(Statement statement) {
    this.statement = Objects.requireNonNull(statement);
  }

  // Visible for testing
  void setPosition(long position) {
    this.position = position;
  }

  // Visible for testing
  long getPosition() {
    return this.position;
  }

  /**
   * Set a ResultSet on this object.
   *
   * @param resultSet The current ResultSet
   */
  public void setResultSet(ResultSet resultSet) {
    resultsInitialized = true;
    this.resultSet = resultSet;
  }

  /**
   * @return The {@link ResultSet} for this Statement, may be null.
   */<commit_msg>[CALCITE-1699] Statement may be null<commit_after>/*
 * 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.calcite.avatica.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;

/**
 * All we know about a statement. Encapsulates a {@link ResultSet}.
 */
public class StatementInfo {
  private volatile Boolean relativeSupported = null;

  final Statement statement; // sometimes a PreparedStatement
  private ResultSet resultSet;
  private long position = 0;

  // True when setResultSet(ResultSet) is called to let us determine the difference between
  // a null ResultSet (from an update) from the lack of a ResultSet.
  private boolean resultsInitialized = false;

  public StatementInfo(Statement statement) {
    // May be null when coming from a DatabaseMetaData call
    this.statement = statement;
  }

  // Visible for testing
  void setPosition(long position) {
    this.position = position;
  }

  // Visible for testing
  long getPosition() {
    return this.position;
  }

  /**
   * Set a ResultSet on this object.
   *
   * @param resultSet The current ResultSet
   */
  public void setResultSet(ResultSet resultSet) {
    resultsInitialized = true;
    this.resultSet = resultSet;
  }

  /**
   * @return The {@link ResultSet} for this Statement, may be null.
   */
{'fraction_non_alphanumeric': 0.07462686567164178, 'fraction_numerical': 0.003316749585406302, 'mean_word_length': 3.7173184357541897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5566365', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1084, 'n_words': 477}