// Path: src/main/java/com/google/cloud/spanner/pgadapter/metadata/DescribeMetadata.java
// public abstract class DescribeMetadata<T> {
// 
//   protected T metadata;
// 
//   public T getMetadata() {
//     return this.metadata;
//   }
// }


import com.google.cloud.spanner.jdbc.JdbcConstants;
import com.google.cloud.spanner.pgadapter.metadata.DescribeMetadata;
import com.google.common.base.Preconditions;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Logger;

  /**
   * Clean up and save metadata when an exception occurs.
   *
   * @param e The exception to store.
   */
  protected void handleExecutionException(SQLException e) {
    this.exception = e;
    this.hasMoreData = false;
    this.statementResult = null;
    this.resultType = ResultType.NO_RESULT;
  }

  /**
   * Execute the SQL statement, storing metadata.
   */
  public void execute() {
    this.executed = true;
    try {
      this.statement.execute(this.sql);
      this.executeHelper();
    } catch (SQLException e) {
      handleExecutionException(e);
    }
  }

  /**
   * Moreso meant for inherited classes, allows one to call describe on a statement. Since raw
   * statements cannot be described, throw an error.
   */
// Path: src/main/java/com/google/cloud/spanner/pgadapter/metadata/DescribeMetadata.java
// public abstract class DescribeMetadata<T> {
// 
//   protected T metadata;
// 
//   public T getMetadata() {
//     return this.metadata;
//   }
// }


// Path: src/main/java/com/google/cloud/spanner/pgadapter/statements/IntermediateStatement.java
import com.google.cloud.spanner.jdbc.JdbcConstants;
import com.google.cloud.spanner.pgadapter.metadata.DescribeMetadata;
import com.google.common.base.Preconditions;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Logger;


  /**
   * Clean up and save metadata when an exception occurs.
   *
   * @param e The exception to store.
   */
  protected void handleExecutionException(SQLException e) {
    this.exception = e;
    this.hasMoreData = false;
    this.statementResult = null;
    this.resultType = ResultType.NO_RESULT;
  }

  /**
   * Execute the SQL statement, storing metadata.
   */
  public void execute() {
    this.executed = true;
    try {
      this.statement.execute(this.sql);
      this.executeHelper();
    } catch (SQLException e) {
      handleExecutionException(e);
    }
  }

  /**
   * Moreso meant for inherited classes, allows one to call describe on a statement. Since raw
   * statements cannot be described, throw an error.
   */
  public DescribeMetadata describe() throws Exception {