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

io.snappydata.thrift.StatementResult Maven / Gradle / Ivy

There is a newer version: 1.6.7
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package io.snappydata.thrift;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2019-08-09")
public class StatementResult implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("StatementResult");

  private static final org.apache.thrift.protocol.TField RESULT_SET_FIELD_DESC = new org.apache.thrift.protocol.TField("resultSet", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField UPDATE_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("updateCount", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField BATCH_UPDATE_COUNTS_FIELD_DESC = new org.apache.thrift.protocol.TField("batchUpdateCounts", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField PROCEDURE_OUT_PARAMS_FIELD_DESC = new org.apache.thrift.protocol.TField("procedureOutParams", org.apache.thrift.protocol.TType.MAP, (short)4);
  private static final org.apache.thrift.protocol.TField GENERATED_KEYS_FIELD_DESC = new org.apache.thrift.protocol.TField("generatedKeys", org.apache.thrift.protocol.TType.STRUCT, (short)5);
  private static final org.apache.thrift.protocol.TField NEW_DEFAULT_SCHEMA_FIELD_DESC = new org.apache.thrift.protocol.TField("newDefaultSchema", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField WARNINGS_FIELD_DESC = new org.apache.thrift.protocol.TField("warnings", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField PREPARED_RESULT_FIELD_DESC = new org.apache.thrift.protocol.TField("preparedResult", org.apache.thrift.protocol.TType.STRUCT, (short)8);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new StatementResultStandardSchemeFactory());
    schemes.put(TupleScheme.class, new StatementResultTupleSchemeFactory());
  }

  public RowSet resultSet; // optional
  public int updateCount; // optional
  public List batchUpdateCounts; // optional
  public Map procedureOutParams; // optional
  public RowSet generatedKeys; // optional
  public String newDefaultSchema; // optional
  public SnappyExceptionData warnings; // optional
  public PrepareResult preparedResult; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    RESULT_SET((short)1, "resultSet"),
    UPDATE_COUNT((short)2, "updateCount"),
    BATCH_UPDATE_COUNTS((short)3, "batchUpdateCounts"),
    PROCEDURE_OUT_PARAMS((short)4, "procedureOutParams"),
    GENERATED_KEYS((short)5, "generatedKeys"),
    NEW_DEFAULT_SCHEMA((short)6, "newDefaultSchema"),
    WARNINGS((short)7, "warnings"),
    PREPARED_RESULT((short)8, "preparedResult");

    private static final Map byName = new HashMap();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // RESULT_SET
          return RESULT_SET;
        case 2: // UPDATE_COUNT
          return UPDATE_COUNT;
        case 3: // BATCH_UPDATE_COUNTS
          return BATCH_UPDATE_COUNTS;
        case 4: // PROCEDURE_OUT_PARAMS
          return PROCEDURE_OUT_PARAMS;
        case 5: // GENERATED_KEYS
          return GENERATED_KEYS;
        case 6: // NEW_DEFAULT_SCHEMA
          return NEW_DEFAULT_SCHEMA;
        case 7: // WARNINGS
          return WARNINGS;
        case 8: // PREPARED_RESULT
          return PREPARED_RESULT;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __UPDATECOUNT_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.RESULT_SET,_Fields.UPDATE_COUNT,_Fields.BATCH_UPDATE_COUNTS,_Fields.PROCEDURE_OUT_PARAMS,_Fields.GENERATED_KEYS,_Fields.NEW_DEFAULT_SCHEMA,_Fields.WARNINGS,_Fields.PREPARED_RESULT};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.RESULT_SET, new org.apache.thrift.meta_data.FieldMetaData("resultSet", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RowSet.class)));
    tmpMap.put(_Fields.UPDATE_COUNT, new org.apache.thrift.meta_data.FieldMetaData("updateCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.BATCH_UPDATE_COUNTS, new org.apache.thrift.meta_data.FieldMetaData("batchUpdateCounts", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))));
    tmpMap.put(_Fields.PROCEDURE_OUT_PARAMS, new org.apache.thrift.meta_data.FieldMetaData("procedureOutParams", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32), 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnValue.class))));
    tmpMap.put(_Fields.GENERATED_KEYS, new org.apache.thrift.meta_data.FieldMetaData("generatedKeys", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RowSet.class)));
    tmpMap.put(_Fields.NEW_DEFAULT_SCHEMA, new org.apache.thrift.meta_data.FieldMetaData("newDefaultSchema", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.WARNINGS, new org.apache.thrift.meta_data.FieldMetaData("warnings", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SnappyExceptionData.class)));
    tmpMap.put(_Fields.PREPARED_RESULT, new org.apache.thrift.meta_data.FieldMetaData("preparedResult", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PrepareResult.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(StatementResult.class, metaDataMap);
  }

  public StatementResult() {
  }

  /**
   * Performs a deep copy on other.
   */
  public StatementResult(StatementResult other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetResultSet()) {
      this.resultSet = new RowSet(other.resultSet);
    }
    this.updateCount = other.updateCount;
    if (other.isSetBatchUpdateCounts()) {
      List __this__batchUpdateCounts = new ArrayList(other.batchUpdateCounts);
      this.batchUpdateCounts = __this__batchUpdateCounts;
    }
    if (other.isSetProcedureOutParams()) {
      Map __this__procedureOutParams = new HashMap(other.procedureOutParams.size());
      for (Map.Entry other_element : other.procedureOutParams.entrySet()) {

        Integer other_element_key = other_element.getKey();
        ColumnValue other_element_value = other_element.getValue();

        Integer __this__procedureOutParams_copy_key = other_element_key;

        ColumnValue __this__procedureOutParams_copy_value = new ColumnValue(other_element_value);

        __this__procedureOutParams.put(__this__procedureOutParams_copy_key, __this__procedureOutParams_copy_value);
      }
      this.procedureOutParams = __this__procedureOutParams;
    }
    if (other.isSetGeneratedKeys()) {
      this.generatedKeys = new RowSet(other.generatedKeys);
    }
    if (other.isSetNewDefaultSchema()) {
      this.newDefaultSchema = other.newDefaultSchema;
    }
    if (other.isSetWarnings()) {
      this.warnings = new SnappyExceptionData(other.warnings);
    }
    if (other.isSetPreparedResult()) {
      this.preparedResult = new PrepareResult(other.preparedResult);
    }
  }

  public StatementResult deepCopy() {
    return new StatementResult(this);
  }

  @Override
  public void clear() {
    this.resultSet = null;
    setUpdateCountIsSet(false);
    this.updateCount = 0;
    this.batchUpdateCounts = null;
    this.procedureOutParams = null;
    this.generatedKeys = null;
    this.newDefaultSchema = null;
    this.warnings = null;
    this.preparedResult = null;
  }

  public RowSet getResultSet() {
    return this.resultSet;
  }

  public StatementResult setResultSet(RowSet resultSet) {
    this.resultSet = resultSet;
    return this;
  }

  public void unsetResultSet() {
    this.resultSet = null;
  }

  /** Returns true if field resultSet is set (has been assigned a value) and false otherwise */
  public boolean isSetResultSet() {
    return this.resultSet != null;
  }

  public void setResultSetIsSet(boolean value) {
    if (!value) {
      this.resultSet = null;
    }
  }

  public int getUpdateCount() {
    return this.updateCount;
  }

  public StatementResult setUpdateCount(int updateCount) {
    this.updateCount = updateCount;
    setUpdateCountIsSet(true);
    return this;
  }

  public void unsetUpdateCount() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UPDATECOUNT_ISSET_ID);
  }

  /** Returns true if field updateCount is set (has been assigned a value) and false otherwise */
  public boolean isSetUpdateCount() {
    return EncodingUtils.testBit(__isset_bitfield, __UPDATECOUNT_ISSET_ID);
  }

  public void setUpdateCountIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UPDATECOUNT_ISSET_ID, value);
  }

  public int getBatchUpdateCountsSize() {
    return (this.batchUpdateCounts == null) ? 0 : this.batchUpdateCounts.size();
  }

  public java.util.Iterator getBatchUpdateCountsIterator() {
    return (this.batchUpdateCounts == null) ? null : this.batchUpdateCounts.iterator();
  }

  public void addToBatchUpdateCounts(int elem) {
    if (this.batchUpdateCounts == null) {
      this.batchUpdateCounts = new ArrayList();
    }
    this.batchUpdateCounts.add(elem);
  }

  public List getBatchUpdateCounts() {
    return this.batchUpdateCounts;
  }

  public StatementResult setBatchUpdateCounts(List batchUpdateCounts) {
    this.batchUpdateCounts = batchUpdateCounts;
    return this;
  }

  public void unsetBatchUpdateCounts() {
    this.batchUpdateCounts = null;
  }

  /** Returns true if field batchUpdateCounts is set (has been assigned a value) and false otherwise */
  public boolean isSetBatchUpdateCounts() {
    return this.batchUpdateCounts != null;
  }

  public void setBatchUpdateCountsIsSet(boolean value) {
    if (!value) {
      this.batchUpdateCounts = null;
    }
  }

  public int getProcedureOutParamsSize() {
    return (this.procedureOutParams == null) ? 0 : this.procedureOutParams.size();
  }

  public void putToProcedureOutParams(int key, ColumnValue val) {
    if (this.procedureOutParams == null) {
      this.procedureOutParams = new HashMap();
    }
    this.procedureOutParams.put(key, val);
  }

  public Map getProcedureOutParams() {
    return this.procedureOutParams;
  }

  public StatementResult setProcedureOutParams(Map procedureOutParams) {
    this.procedureOutParams = procedureOutParams;
    return this;
  }

  public void unsetProcedureOutParams() {
    this.procedureOutParams = null;
  }

  /** Returns true if field procedureOutParams is set (has been assigned a value) and false otherwise */
  public boolean isSetProcedureOutParams() {
    return this.procedureOutParams != null;
  }

  public void setProcedureOutParamsIsSet(boolean value) {
    if (!value) {
      this.procedureOutParams = null;
    }
  }

  public RowSet getGeneratedKeys() {
    return this.generatedKeys;
  }

  public StatementResult setGeneratedKeys(RowSet generatedKeys) {
    this.generatedKeys = generatedKeys;
    return this;
  }

  public void unsetGeneratedKeys() {
    this.generatedKeys = null;
  }

  /** Returns true if field generatedKeys is set (has been assigned a value) and false otherwise */
  public boolean isSetGeneratedKeys() {
    return this.generatedKeys != null;
  }

  public void setGeneratedKeysIsSet(boolean value) {
    if (!value) {
      this.generatedKeys = null;
    }
  }

  public String getNewDefaultSchema() {
    return this.newDefaultSchema;
  }

  public StatementResult setNewDefaultSchema(String newDefaultSchema) {
    this.newDefaultSchema = newDefaultSchema;
    return this;
  }

  public void unsetNewDefaultSchema() {
    this.newDefaultSchema = null;
  }

  /** Returns true if field newDefaultSchema is set (has been assigned a value) and false otherwise */
  public boolean isSetNewDefaultSchema() {
    return this.newDefaultSchema != null;
  }

  public void setNewDefaultSchemaIsSet(boolean value) {
    if (!value) {
      this.newDefaultSchema = null;
    }
  }

  public SnappyExceptionData getWarnings() {
    return this.warnings;
  }

  public StatementResult setWarnings(SnappyExceptionData warnings) {
    this.warnings = warnings;
    return this;
  }

  public void unsetWarnings() {
    this.warnings = null;
  }

  /** Returns true if field warnings is set (has been assigned a value) and false otherwise */
  public boolean isSetWarnings() {
    return this.warnings != null;
  }

  public void setWarningsIsSet(boolean value) {
    if (!value) {
      this.warnings = null;
    }
  }

  public PrepareResult getPreparedResult() {
    return this.preparedResult;
  }

  public StatementResult setPreparedResult(PrepareResult preparedResult) {
    this.preparedResult = preparedResult;
    return this;
  }

  public void unsetPreparedResult() {
    this.preparedResult = null;
  }

  /** Returns true if field preparedResult is set (has been assigned a value) and false otherwise */
  public boolean isSetPreparedResult() {
    return this.preparedResult != null;
  }

  public void setPreparedResultIsSet(boolean value) {
    if (!value) {
      this.preparedResult = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case RESULT_SET:
      if (value == null) {
        unsetResultSet();
      } else {
        setResultSet((RowSet)value);
      }
      break;

    case UPDATE_COUNT:
      if (value == null) {
        unsetUpdateCount();
      } else {
        setUpdateCount((Integer)value);
      }
      break;

    case BATCH_UPDATE_COUNTS:
      if (value == null) {
        unsetBatchUpdateCounts();
      } else {
        setBatchUpdateCounts((List)value);
      }
      break;

    case PROCEDURE_OUT_PARAMS:
      if (value == null) {
        unsetProcedureOutParams();
      } else {
        setProcedureOutParams((Map)value);
      }
      break;

    case GENERATED_KEYS:
      if (value == null) {
        unsetGeneratedKeys();
      } else {
        setGeneratedKeys((RowSet)value);
      }
      break;

    case NEW_DEFAULT_SCHEMA:
      if (value == null) {
        unsetNewDefaultSchema();
      } else {
        setNewDefaultSchema((String)value);
      }
      break;

    case WARNINGS:
      if (value == null) {
        unsetWarnings();
      } else {
        setWarnings((SnappyExceptionData)value);
      }
      break;

    case PREPARED_RESULT:
      if (value == null) {
        unsetPreparedResult();
      } else {
        setPreparedResult((PrepareResult)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case RESULT_SET:
      return getResultSet();

    case UPDATE_COUNT:
      return getUpdateCount();

    case BATCH_UPDATE_COUNTS:
      return getBatchUpdateCounts();

    case PROCEDURE_OUT_PARAMS:
      return getProcedureOutParams();

    case GENERATED_KEYS:
      return getGeneratedKeys();

    case NEW_DEFAULT_SCHEMA:
      return getNewDefaultSchema();

    case WARNINGS:
      return getWarnings();

    case PREPARED_RESULT:
      return getPreparedResult();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case RESULT_SET:
      return isSetResultSet();
    case UPDATE_COUNT:
      return isSetUpdateCount();
    case BATCH_UPDATE_COUNTS:
      return isSetBatchUpdateCounts();
    case PROCEDURE_OUT_PARAMS:
      return isSetProcedureOutParams();
    case GENERATED_KEYS:
      return isSetGeneratedKeys();
    case NEW_DEFAULT_SCHEMA:
      return isSetNewDefaultSchema();
    case WARNINGS:
      return isSetWarnings();
    case PREPARED_RESULT:
      return isSetPreparedResult();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof StatementResult)
      return this.equals((StatementResult)that);
    return false;
  }

  public boolean equals(StatementResult that) {
    if (that == null)
      return false;

    boolean this_present_resultSet = true && this.isSetResultSet();
    boolean that_present_resultSet = true && that.isSetResultSet();
    if (this_present_resultSet || that_present_resultSet) {
      if (!(this_present_resultSet && that_present_resultSet))
        return false;
      if (!this.resultSet.equals(that.resultSet))
        return false;
    }

    boolean this_present_updateCount = true && this.isSetUpdateCount();
    boolean that_present_updateCount = true && that.isSetUpdateCount();
    if (this_present_updateCount || that_present_updateCount) {
      if (!(this_present_updateCount && that_present_updateCount))
        return false;
      if (this.updateCount != that.updateCount)
        return false;
    }

    boolean this_present_batchUpdateCounts = true && this.isSetBatchUpdateCounts();
    boolean that_present_batchUpdateCounts = true && that.isSetBatchUpdateCounts();
    if (this_present_batchUpdateCounts || that_present_batchUpdateCounts) {
      if (!(this_present_batchUpdateCounts && that_present_batchUpdateCounts))
        return false;
      if (!this.batchUpdateCounts.equals(that.batchUpdateCounts))
        return false;
    }

    boolean this_present_procedureOutParams = true && this.isSetProcedureOutParams();
    boolean that_present_procedureOutParams = true && that.isSetProcedureOutParams();
    if (this_present_procedureOutParams || that_present_procedureOutParams) {
      if (!(this_present_procedureOutParams && that_present_procedureOutParams))
        return false;
      if (!this.procedureOutParams.equals(that.procedureOutParams))
        return false;
    }

    boolean this_present_generatedKeys = true && this.isSetGeneratedKeys();
    boolean that_present_generatedKeys = true && that.isSetGeneratedKeys();
    if (this_present_generatedKeys || that_present_generatedKeys) {
      if (!(this_present_generatedKeys && that_present_generatedKeys))
        return false;
      if (!this.generatedKeys.equals(that.generatedKeys))
        return false;
    }

    boolean this_present_newDefaultSchema = true && this.isSetNewDefaultSchema();
    boolean that_present_newDefaultSchema = true && that.isSetNewDefaultSchema();
    if (this_present_newDefaultSchema || that_present_newDefaultSchema) {
      if (!(this_present_newDefaultSchema && that_present_newDefaultSchema))
        return false;
      if (!this.newDefaultSchema.equals(that.newDefaultSchema))
        return false;
    }

    boolean this_present_warnings = true && this.isSetWarnings();
    boolean that_present_warnings = true && that.isSetWarnings();
    if (this_present_warnings || that_present_warnings) {
      if (!(this_present_warnings && that_present_warnings))
        return false;
      if (!this.warnings.equals(that.warnings))
        return false;
    }

    boolean this_present_preparedResult = true && this.isSetPreparedResult();
    boolean that_present_preparedResult = true && that.isSetPreparedResult();
    if (this_present_preparedResult || that_present_preparedResult) {
      if (!(this_present_preparedResult && that_present_preparedResult))
        return false;
      if (!this.preparedResult.equals(that.preparedResult))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List list = new ArrayList();

    boolean present_resultSet = true && (isSetResultSet());
    list.add(present_resultSet);
    if (present_resultSet)
      list.add(resultSet);

    boolean present_updateCount = true && (isSetUpdateCount());
    list.add(present_updateCount);
    if (present_updateCount)
      list.add(updateCount);

    boolean present_batchUpdateCounts = true && (isSetBatchUpdateCounts());
    list.add(present_batchUpdateCounts);
    if (present_batchUpdateCounts)
      list.add(batchUpdateCounts);

    boolean present_procedureOutParams = true && (isSetProcedureOutParams());
    list.add(present_procedureOutParams);
    if (present_procedureOutParams)
      list.add(procedureOutParams);

    boolean present_generatedKeys = true && (isSetGeneratedKeys());
    list.add(present_generatedKeys);
    if (present_generatedKeys)
      list.add(generatedKeys);

    boolean present_newDefaultSchema = true && (isSetNewDefaultSchema());
    list.add(present_newDefaultSchema);
    if (present_newDefaultSchema)
      list.add(newDefaultSchema);

    boolean present_warnings = true && (isSetWarnings());
    list.add(present_warnings);
    if (present_warnings)
      list.add(warnings);

    boolean present_preparedResult = true && (isSetPreparedResult());
    list.add(present_preparedResult);
    if (present_preparedResult)
      list.add(preparedResult);

    return list.hashCode();
  }

  @Override
  public int compareTo(StatementResult other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetResultSet()).compareTo(other.isSetResultSet());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetResultSet()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resultSet, other.resultSet);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpdateCount()).compareTo(other.isSetUpdateCount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdateCount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updateCount, other.updateCount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBatchUpdateCounts()).compareTo(other.isSetBatchUpdateCounts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBatchUpdateCounts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batchUpdateCounts, other.batchUpdateCounts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProcedureOutParams()).compareTo(other.isSetProcedureOutParams());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProcedureOutParams()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.procedureOutParams, other.procedureOutParams);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGeneratedKeys()).compareTo(other.isSetGeneratedKeys());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGeneratedKeys()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.generatedKeys, other.generatedKeys);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNewDefaultSchema()).compareTo(other.isSetNewDefaultSchema());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNewDefaultSchema()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newDefaultSchema, other.newDefaultSchema);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetWarnings()).compareTo(other.isSetWarnings());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWarnings()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.warnings, other.warnings);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPreparedResult()).compareTo(other.isSetPreparedResult());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPreparedResult()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.preparedResult, other.preparedResult);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("StatementResult(");
    boolean first = true;

    if (isSetResultSet()) {
      sb.append("resultSet:");
      if (this.resultSet == null) {
        sb.append("null");
      } else {
        sb.append(this.resultSet);
      }
      first = false;
    }
    if (isSetUpdateCount()) {
      if (!first) sb.append(", ");
      sb.append("updateCount:");
      sb.append(this.updateCount);
      first = false;
    }
    if (isSetBatchUpdateCounts()) {
      if (!first) sb.append(", ");
      sb.append("batchUpdateCounts:");
      if (this.batchUpdateCounts == null) {
        sb.append("null");
      } else {
        sb.append(this.batchUpdateCounts);
      }
      first = false;
    }
    if (isSetProcedureOutParams()) {
      if (!first) sb.append(", ");
      sb.append("procedureOutParams:");
      if (this.procedureOutParams == null) {
        sb.append("null");
      } else {
        sb.append(this.procedureOutParams);
      }
      first = false;
    }
    if (isSetGeneratedKeys()) {
      if (!first) sb.append(", ");
      sb.append("generatedKeys:");
      if (this.generatedKeys == null) {
        sb.append("null");
      } else {
        sb.append(this.generatedKeys);
      }
      first = false;
    }
    if (isSetNewDefaultSchema()) {
      if (!first) sb.append(", ");
      sb.append("newDefaultSchema:");
      if (this.newDefaultSchema == null) {
        sb.append("null");
      } else {
        sb.append(this.newDefaultSchema);
      }
      first = false;
    }
    if (isSetWarnings()) {
      if (!first) sb.append(", ");
      sb.append("warnings:");
      if (this.warnings == null) {
        sb.append("null");
      } else {
        sb.append(this.warnings);
      }
      first = false;
    }
    if (isSetPreparedResult()) {
      if (!first) sb.append(", ");
      sb.append("preparedResult:");
      if (this.preparedResult == null) {
        sb.append("null");
      } else {
        sb.append(this.preparedResult);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (resultSet != null) {
      resultSet.validate();
    }
    if (generatedKeys != null) {
      generatedKeys.validate();
    }
    if (warnings != null) {
      warnings.validate();
    }
    if (preparedResult != null) {
      preparedResult.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class StatementResultStandardSchemeFactory implements SchemeFactory {
    public StatementResultStandardScheme getScheme() {
      return new StatementResultStandardScheme();
    }
  }

  private static class StatementResultStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, StatementResult struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // RESULT_SET
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.resultSet = new RowSet();
              struct.resultSet.read(iprot);
              struct.setResultSetIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // UPDATE_COUNT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.updateCount = iprot.readI32();
              struct.setUpdateCountIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BATCH_UPDATE_COUNTS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list252 = iprot.readListBegin();
                struct.batchUpdateCounts = new ArrayList(_list252.size);
                int _elem253;
                for (int _i254 = 0; _i254 < _list252.size; ++_i254)
                {
                  _elem253 = iprot.readI32();
                  struct.batchUpdateCounts.add(_elem253);
                }
                iprot.readListEnd();
              }
              struct.setBatchUpdateCountsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PROCEDURE_OUT_PARAMS
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map255 = iprot.readMapBegin();
                struct.procedureOutParams = new HashMap(2*_map255.size);
                int _key256;
                ColumnValue _val257;
                for (int _i258 = 0; _i258 < _map255.size; ++_i258)
                {
                  _key256 = iprot.readI32();
                  _val257 = new ColumnValue();
                  _val257.read(iprot);
                  struct.procedureOutParams.put(_key256, _val257);
                }
                iprot.readMapEnd();
              }
              struct.setProcedureOutParamsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // GENERATED_KEYS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.generatedKeys = new RowSet();
              struct.generatedKeys.read(iprot);
              struct.setGeneratedKeysIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // NEW_DEFAULT_SCHEMA
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.newDefaultSchema = iprot.readString();
              struct.setNewDefaultSchemaIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // WARNINGS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.warnings = new SnappyExceptionData();
              struct.warnings.read(iprot);
              struct.setWarningsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // PREPARED_RESULT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.preparedResult = new PrepareResult();
              struct.preparedResult.read(iprot);
              struct.setPreparedResultIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, StatementResult struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.resultSet != null) {
        if (struct.isSetResultSet()) {
          oprot.writeFieldBegin(RESULT_SET_FIELD_DESC);
          struct.resultSet.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetUpdateCount()) {
        oprot.writeFieldBegin(UPDATE_COUNT_FIELD_DESC);
        oprot.writeI32(struct.updateCount);
        oprot.writeFieldEnd();
      }
      if (struct.batchUpdateCounts != null) {
        if (struct.isSetBatchUpdateCounts()) {
          oprot.writeFieldBegin(BATCH_UPDATE_COUNTS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, struct.batchUpdateCounts.size()));
            for (int _iter259 : struct.batchUpdateCounts)
            {
              oprot.writeI32(_iter259);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.procedureOutParams != null) {
        if (struct.isSetProcedureOutParams()) {
          oprot.writeFieldBegin(PROCEDURE_OUT_PARAMS_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, struct.procedureOutParams.size()));
            for (Map.Entry _iter260 : struct.procedureOutParams.entrySet())
            {
              oprot.writeI32(_iter260.getKey());
              _iter260.getValue().write(oprot);
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.generatedKeys != null) {
        if (struct.isSetGeneratedKeys()) {
          oprot.writeFieldBegin(GENERATED_KEYS_FIELD_DESC);
          struct.generatedKeys.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.newDefaultSchema != null) {
        if (struct.isSetNewDefaultSchema()) {
          oprot.writeFieldBegin(NEW_DEFAULT_SCHEMA_FIELD_DESC);
          oprot.writeString(struct.newDefaultSchema);
          oprot.writeFieldEnd();
        }
      }
      if (struct.warnings != null) {
        if (struct.isSetWarnings()) {
          oprot.writeFieldBegin(WARNINGS_FIELD_DESC);
          struct.warnings.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.preparedResult != null) {
        if (struct.isSetPreparedResult()) {
          oprot.writeFieldBegin(PREPARED_RESULT_FIELD_DESC);
          struct.preparedResult.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class StatementResultTupleSchemeFactory implements SchemeFactory {
    public StatementResultTupleScheme getScheme() {
      return new StatementResultTupleScheme();
    }
  }

  private static class StatementResultTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, StatementResult struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetResultSet()) {
        optionals.set(0);
      }
      if (struct.isSetUpdateCount()) {
        optionals.set(1);
      }
      if (struct.isSetBatchUpdateCounts()) {
        optionals.set(2);
      }
      if (struct.isSetProcedureOutParams()) {
        optionals.set(3);
      }
      if (struct.isSetGeneratedKeys()) {
        optionals.set(4);
      }
      if (struct.isSetNewDefaultSchema()) {
        optionals.set(5);
      }
      if (struct.isSetWarnings()) {
        optionals.set(6);
      }
      if (struct.isSetPreparedResult()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetResultSet()) {
        struct.resultSet.write(oprot);
      }
      if (struct.isSetUpdateCount()) {
        oprot.writeI32(struct.updateCount);
      }
      if (struct.isSetBatchUpdateCounts()) {
        {
          oprot.writeI32(struct.batchUpdateCounts.size());
          for (int _iter261 : struct.batchUpdateCounts)
          {
            oprot.writeI32(_iter261);
          }
        }
      }
      if (struct.isSetProcedureOutParams()) {
        {
          oprot.writeI32(struct.procedureOutParams.size());
          for (Map.Entry _iter262 : struct.procedureOutParams.entrySet())
          {
            oprot.writeI32(_iter262.getKey());
            _iter262.getValue().write(oprot);
          }
        }
      }
      if (struct.isSetGeneratedKeys()) {
        struct.generatedKeys.write(oprot);
      }
      if (struct.isSetNewDefaultSchema()) {
        oprot.writeString(struct.newDefaultSchema);
      }
      if (struct.isSetWarnings()) {
        struct.warnings.write(oprot);
      }
      if (struct.isSetPreparedResult()) {
        struct.preparedResult.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, StatementResult struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.resultSet = new RowSet();
        struct.resultSet.read(iprot);
        struct.setResultSetIsSet(true);
      }
      if (incoming.get(1)) {
        struct.updateCount = iprot.readI32();
        struct.setUpdateCountIsSet(true);
      }
      if (incoming.get(2)) {
        {
          org.apache.thrift.protocol.TList _list263 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.I32, iprot.readI32());
          struct.batchUpdateCounts = new ArrayList(_list263.size);
          int _elem264;
          for (int _i265 = 0; _i265 < _list263.size; ++_i265)
          {
            _elem264 = iprot.readI32();
            struct.batchUpdateCounts.add(_elem264);
          }
        }
        struct.setBatchUpdateCountsIsSet(true);
      }
      if (incoming.get(3)) {
        {
          org.apache.thrift.protocol.TMap _map266 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.procedureOutParams = new HashMap(2*_map266.size);
          int _key267;
          ColumnValue _val268;
          for (int _i269 = 0; _i269 < _map266.size; ++_i269)
          {
            _key267 = iprot.readI32();
            _val268 = new ColumnValue();
            _val268.read(iprot);
            struct.procedureOutParams.put(_key267, _val268);
          }
        }
        struct.setProcedureOutParamsIsSet(true);
      }
      if (incoming.get(4)) {
        struct.generatedKeys = new RowSet();
        struct.generatedKeys.read(iprot);
        struct.setGeneratedKeysIsSet(true);
      }
      if (incoming.get(5)) {
        struct.newDefaultSchema = iprot.readString();
        struct.setNewDefaultSchemaIsSet(true);
      }
      if (incoming.get(6)) {
        struct.warnings = new SnappyExceptionData();
        struct.warnings.read(iprot);
        struct.setWarningsIsSet(true);
      }
      if (incoming.get(7)) {
        struct.preparedResult = new PrepareResult();
        struct.preparedResult.read(iprot);
        struct.setPreparedResultIsSet(true);
      }
    }
  }

}