All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.snowflake.client.core.SFStatementMetaData Maven / Gradle / Ivy

There is a newer version: 3.19.0
Show newest version
/*
 * Copyright (c) 2012-2017 Snowflake Computing Inc. All rights reserved.
 */

package net.snowflake.client.core;

/**
 * Created by jhuang on 1/21/16.
 */

import java.util.Collections;

/**
 * Statement metadata which includes the result metadata and bind information.
 */
public class SFStatementMetaData
{
  // result metadata
  private SFResultSetMetaData resultSetMetaData;

  // number of binds
  private int numberOfBinds;

  private final SFStatementType statementType;

  private final boolean arrayBindSupported;

  SFStatementMetaData(SFResultSetMetaData resultSetMetaData,
                      SFStatementType statementType,
                      int numberOfBinds,
                      boolean arrayBindSupported)
  {
    this.resultSetMetaData = resultSetMetaData;
    this.statementType = statementType;
    this.numberOfBinds = numberOfBinds;
    this.arrayBindSupported = arrayBindSupported;
  }

  public SFResultSetMetaData getResultSetMetaData()
  {
    return resultSetMetaData;
  }

  public void setResultSetMetaData(SFResultSetMetaData resultSetMetaData)
  {
    this.resultSetMetaData = resultSetMetaData;
  }

  public int getNumberOfBinds()
  {
    return numberOfBinds;
  }

  public void setNumberOfBinds(int numberOfBinds)
  {
    this.numberOfBinds = numberOfBinds;
  }

  /**
   * According to StatementType, to decide whether array binds supported or not
   *
   * Currently, only INSERT supports array bind
   * @return true if array binds is supported.
   */
  public boolean isArrayBindSupported()
  {
    return this.arrayBindSupported;
  }

  public SFStatementType getStatementType()
  {
    return this.statementType;
  }

  public static SFStatementMetaData emptyMetaData()
  {
    return new SFStatementMetaData(
        new SFResultSetMetaData(0,
                                Collections.emptyList(),
                                Collections.emptyList(),
                                Collections.emptyList(),
                                null),
        SFStatementType.UNKNOWN,
        0,
        false);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy