/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.hadoop.hive.metastore.api;

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)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class SQLForeignKey implements org.apache.thrift.TBase<SQLForeignKey, SQLForeignKey._Fields>, java.io.Serializable, Cloneable, Comparable<SQLForeignKey> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SQLForeignKey");

  private static final org.apache.thrift.protocol.TField PKTABLE_DB_FIELD_DESC = new org.apache.thrift.protocol.TField("pktable_db", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField PKTABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("pktable_name", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField PKCOLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("pkcolumn_name", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField FKTABLE_DB_FIELD_DESC = new org.apache.thrift.protocol.TField("fktable_db", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField FKTABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fktable_name", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField FKCOLUMN_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fkcolumn_name", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField KEY_SEQ_FIELD_DESC = new org.apache.thrift.protocol.TField("key_seq", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField UPDATE_RULE_FIELD_DESC = new org.apache.thrift.protocol.TField("update_rule", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField DELETE_RULE_FIELD_DESC = new org.apache.thrift.protocol.TField("delete_rule", org.apache.thrift.protocol.TType.I32, (short)9);
  private static final org.apache.thrift.protocol.TField FK_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fk_name", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField PK_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("pk_name", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField ENABLE_CSTR_FIELD_DESC = new org.apache.thrift.protocol.TField("enable_cstr", org.apache.thrift.protocol.TType.BOOL, (short)12);
  private static final org.apache.thrift.protocol.TField VALIDATE_CSTR_FIELD_DESC = new org.apache.thrift.protocol.TField("validate_cstr", org.apache.thrift.protocol.TType.BOOL, (short)13);
  private static final org.apache.thrift.protocol.TField RELY_CSTR_FIELD_DESC = new org.apache.thrift.protocol.TField("rely_cstr", org.apache.thrift.protocol.TType.BOOL, (short)14);
  private static final org.apache.thrift.protocol.TField CAT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("catName", org.apache.thrift.protocol.TType.STRING, (short)15);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new SQLForeignKeyStandardSchemeFactory());
    schemes.put(TupleScheme.class, new SQLForeignKeyTupleSchemeFactory());
  }

  private String pktable_db; // required
  private String pktable_name; // required
  private String pkcolumn_name; // required
  private String fktable_db; // required
  private String fktable_name; // required
  private String fkcolumn_name; // required
  private int key_seq; // required
  private int update_rule; // required
  private int delete_rule; // required
  private String fk_name; // required
  private String pk_name; // required
  private boolean enable_cstr; // required
  private boolean validate_cstr; // required
  private boolean rely_cstr; // required
  private String catName; // 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 {
    PKTABLE_DB((short)1, "pktable_db"),
    PKTABLE_NAME((short)2, "pktable_name"),
    PKCOLUMN_NAME((short)3, "pkcolumn_name"),
    FKTABLE_DB((short)4, "fktable_db"),
    FKTABLE_NAME((short)5, "fktable_name"),
    FKCOLUMN_NAME((short)6, "fkcolumn_name"),
    KEY_SEQ((short)7, "key_seq"),
    UPDATE_RULE((short)8, "update_rule"),
    DELETE_RULE((short)9, "delete_rule"),
    FK_NAME((short)10, "fk_name"),
    PK_NAME((short)11, "pk_name"),
    ENABLE_CSTR((short)12, "enable_cstr"),
    VALIDATE_CSTR((short)13, "validate_cstr"),
    RELY_CSTR((short)14, "rely_cstr"),
    CAT_NAME((short)15, "catName");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    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: // PKTABLE_DB
          return PKTABLE_DB;
        case 2: // PKTABLE_NAME
          return PKTABLE_NAME;
        case 3: // PKCOLUMN_NAME
          return PKCOLUMN_NAME;
        case 4: // FKTABLE_DB
          return FKTABLE_DB;
        case 5: // FKTABLE_NAME
          return FKTABLE_NAME;
        case 6: // FKCOLUMN_NAME
          return FKCOLUMN_NAME;
        case 7: // KEY_SEQ
          return KEY_SEQ;
        case 8: // UPDATE_RULE
          return UPDATE_RULE;
        case 9: // DELETE_RULE
          return DELETE_RULE;
        case 10: // FK_NAME
          return FK_NAME;
        case 11: // PK_NAME
          return PK_NAME;
        case 12: // ENABLE_CSTR
          return ENABLE_CSTR;
        case 13: // VALIDATE_CSTR
          return VALIDATE_CSTR;
        case 14: // RELY_CSTR
          return RELY_CSTR;
        case 15: // CAT_NAME
          return CAT_NAME;
        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 __KEY_SEQ_ISSET_ID = 0;
  private static final int __UPDATE_RULE_ISSET_ID = 1;
  private static final int __DELETE_RULE_ISSET_ID = 2;
  private static final int __ENABLE_CSTR_ISSET_ID = 3;
  private static final int __VALIDATE_CSTR_ISSET_ID = 4;
  private static final int __RELY_CSTR_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.CAT_NAME};
  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.PKTABLE_DB, new org.apache.thrift.meta_data.FieldMetaData("pktable_db", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PKTABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("pktable_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PKCOLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("pkcolumn_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FKTABLE_DB, new org.apache.thrift.meta_data.FieldMetaData("fktable_db", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FKTABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("fktable_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.FKCOLUMN_NAME, new org.apache.thrift.meta_data.FieldMetaData("fkcolumn_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.KEY_SEQ, new org.apache.thrift.meta_data.FieldMetaData("key_seq", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.UPDATE_RULE, new org.apache.thrift.meta_data.FieldMetaData("update_rule", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.DELETE_RULE, new org.apache.thrift.meta_data.FieldMetaData("delete_rule", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.FK_NAME, new org.apache.thrift.meta_data.FieldMetaData("fk_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PK_NAME, new org.apache.thrift.meta_data.FieldMetaData("pk_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ENABLE_CSTR, new org.apache.thrift.meta_data.FieldMetaData("enable_cstr", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.VALIDATE_CSTR, new org.apache.thrift.meta_data.FieldMetaData("validate_cstr", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.RELY_CSTR, new org.apache.thrift.meta_data.FieldMetaData("rely_cstr", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.CAT_NAME, new org.apache.thrift.meta_data.FieldMetaData("catName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SQLForeignKey.class, metaDataMap);
  }

  public SQLForeignKey() {
  }

  public SQLForeignKey(
    String pktable_db,
    String pktable_name,
    String pkcolumn_name,
    String fktable_db,
    String fktable_name,
    String fkcolumn_name,
    int key_seq,
    int update_rule,
    int delete_rule,
    String fk_name,
    String pk_name,
    boolean enable_cstr,
    boolean validate_cstr,
    boolean rely_cstr)
  {
    this();
    this.pktable_db = pktable_db;
    this.pktable_name = pktable_name;
    this.pkcolumn_name = pkcolumn_name;
    this.fktable_db = fktable_db;
    this.fktable_name = fktable_name;
    this.fkcolumn_name = fkcolumn_name;
    this.key_seq = key_seq;
    setKey_seqIsSet(true);
    this.update_rule = update_rule;
    setUpdate_ruleIsSet(true);
    this.delete_rule = delete_rule;
    setDelete_ruleIsSet(true);
    this.fk_name = fk_name;
    this.pk_name = pk_name;
    this.enable_cstr = enable_cstr;
    setEnable_cstrIsSet(true);
    this.validate_cstr = validate_cstr;
    setValidate_cstrIsSet(true);
    this.rely_cstr = rely_cstr;
    setRely_cstrIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public SQLForeignKey(SQLForeignKey other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetPktable_db()) {
      this.pktable_db = other.pktable_db;
    }
    if (other.isSetPktable_name()) {
      this.pktable_name = other.pktable_name;
    }
    if (other.isSetPkcolumn_name()) {
      this.pkcolumn_name = other.pkcolumn_name;
    }
    if (other.isSetFktable_db()) {
      this.fktable_db = other.fktable_db;
    }
    if (other.isSetFktable_name()) {
      this.fktable_name = other.fktable_name;
    }
    if (other.isSetFkcolumn_name()) {
      this.fkcolumn_name = other.fkcolumn_name;
    }
    this.key_seq = other.key_seq;
    this.update_rule = other.update_rule;
    this.delete_rule = other.delete_rule;
    if (other.isSetFk_name()) {
      this.fk_name = other.fk_name;
    }
    if (other.isSetPk_name()) {
      this.pk_name = other.pk_name;
    }
    this.enable_cstr = other.enable_cstr;
    this.validate_cstr = other.validate_cstr;
    this.rely_cstr = other.rely_cstr;
    if (other.isSetCatName()) {
      this.catName = other.catName;
    }
  }

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

  @Override
  public void clear() {
    this.pktable_db = null;
    this.pktable_name = null;
    this.pkcolumn_name = null;
    this.fktable_db = null;
    this.fktable_name = null;
    this.fkcolumn_name = null;
    setKey_seqIsSet(false);
    this.key_seq = 0;
    setUpdate_ruleIsSet(false);
    this.update_rule = 0;
    setDelete_ruleIsSet(false);
    this.delete_rule = 0;
    this.fk_name = null;
    this.pk_name = null;
    setEnable_cstrIsSet(false);
    this.enable_cstr = false;
    setValidate_cstrIsSet(false);
    this.validate_cstr = false;
    setRely_cstrIsSet(false);
    this.rely_cstr = false;
    this.catName = null;
  }

  public String getPktable_db() {
    return this.pktable_db;
  }

  public void setPktable_db(String pktable_db) {
    this.pktable_db = pktable_db;
  }

  public void unsetPktable_db() {
    this.pktable_db = null;
  }

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

  public void setPktable_dbIsSet(boolean value) {
    if (!value) {
      this.pktable_db = null;
    }
  }

  public String getPktable_name() {
    return this.pktable_name;
  }

  public void setPktable_name(String pktable_name) {
    this.pktable_name = pktable_name;
  }

  public void unsetPktable_name() {
    this.pktable_name = null;
  }

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

  public void setPktable_nameIsSet(boolean value) {
    if (!value) {
      this.pktable_name = null;
    }
  }

  public String getPkcolumn_name() {
    return this.pkcolumn_name;
  }

  public void setPkcolumn_name(String pkcolumn_name) {
    this.pkcolumn_name = pkcolumn_name;
  }

  public void unsetPkcolumn_name() {
    this.pkcolumn_name = null;
  }

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

  public void setPkcolumn_nameIsSet(boolean value) {
    if (!value) {
      this.pkcolumn_name = null;
    }
  }

  public String getFktable_db() {
    return this.fktable_db;
  }

  public void setFktable_db(String fktable_db) {
    this.fktable_db = fktable_db;
  }

  public void unsetFktable_db() {
    this.fktable_db = null;
  }

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

  public void setFktable_dbIsSet(boolean value) {
    if (!value) {
      this.fktable_db = null;
    }
  }

  public String getFktable_name() {
    return this.fktable_name;
  }

  public void setFktable_name(String fktable_name) {
    this.fktable_name = fktable_name;
  }

  public void unsetFktable_name() {
    this.fktable_name = null;
  }

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

  public void setFktable_nameIsSet(boolean value) {
    if (!value) {
      this.fktable_name = null;
    }
  }

  public String getFkcolumn_name() {
    return this.fkcolumn_name;
  }

  public void setFkcolumn_name(String fkcolumn_name) {
    this.fkcolumn_name = fkcolumn_name;
  }

  public void unsetFkcolumn_name() {
    this.fkcolumn_name = null;
  }

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

  public void setFkcolumn_nameIsSet(boolean value) {
    if (!value) {
      this.fkcolumn_name = null;
    }
  }

  public int getKey_seq() {
    return this.key_seq;
  }

  public void setKey_seq(int key_seq) {
    this.key_seq = key_seq;
    setKey_seqIsSet(true);
  }

  public void unsetKey_seq() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __KEY_SEQ_ISSET_ID);
  }

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

  public void setKey_seqIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __KEY_SEQ_ISSET_ID, value);
  }

  public int getUpdate_rule() {
    return this.update_rule;
  }

  public void setUpdate_rule(int update_rule) {
    this.update_rule = update_rule;
    setUpdate_ruleIsSet(true);
  }

  public void unsetUpdate_rule() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UPDATE_RULE_ISSET_ID);
  }

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

  public void setUpdate_ruleIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UPDATE_RULE_ISSET_ID, value);
  }

  public int getDelete_rule() {
    return this.delete_rule;
  }

  public void setDelete_rule(int delete_rule) {
    this.delete_rule = delete_rule;
    setDelete_ruleIsSet(true);
  }

  public void unsetDelete_rule() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DELETE_RULE_ISSET_ID);
  }

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

  public void setDelete_ruleIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DELETE_RULE_ISSET_ID, value);
  }

  public String getFk_name() {
    return this.fk_name;
  }

  public void setFk_name(String fk_name) {
    this.fk_name = fk_name;
  }

  public void unsetFk_name() {
    this.fk_name = null;
  }

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

  public void setFk_nameIsSet(boolean value) {
    if (!value) {
      this.fk_name = null;
    }
  }

  public String getPk_name() {
    return this.pk_name;
  }

  public void setPk_name(String pk_name) {
    this.pk_name = pk_name;
  }

  public void unsetPk_name() {
    this.pk_name = null;
  }

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

  public void setPk_nameIsSet(boolean value) {
    if (!value) {
      this.pk_name = null;
    }
  }

  public boolean isEnable_cstr() {
    return this.enable_cstr;
  }

  public void setEnable_cstr(boolean enable_cstr) {
    this.enable_cstr = enable_cstr;
    setEnable_cstrIsSet(true);
  }

  public void unsetEnable_cstr() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ENABLE_CSTR_ISSET_ID);
  }

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

  public void setEnable_cstrIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ENABLE_CSTR_ISSET_ID, value);
  }

  public boolean isValidate_cstr() {
    return this.validate_cstr;
  }

  public void setValidate_cstr(boolean validate_cstr) {
    this.validate_cstr = validate_cstr;
    setValidate_cstrIsSet(true);
  }

  public void unsetValidate_cstr() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VALIDATE_CSTR_ISSET_ID);
  }

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

  public void setValidate_cstrIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VALIDATE_CSTR_ISSET_ID, value);
  }

  public boolean isRely_cstr() {
    return this.rely_cstr;
  }

  public void setRely_cstr(boolean rely_cstr) {
    this.rely_cstr = rely_cstr;
    setRely_cstrIsSet(true);
  }

  public void unsetRely_cstr() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RELY_CSTR_ISSET_ID);
  }

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

  public void setRely_cstrIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RELY_CSTR_ISSET_ID, value);
  }

  public String getCatName() {
    return this.catName;
  }

  public void setCatName(String catName) {
    this.catName = catName;
  }

  public void unsetCatName() {
    this.catName = null;
  }

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

  public void setCatNameIsSet(boolean value) {
    if (!value) {
      this.catName = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case PKTABLE_DB:
      if (value == null) {
        unsetPktable_db();
      } else {
        setPktable_db((String)value);
      }
      break;

    case PKTABLE_NAME:
      if (value == null) {
        unsetPktable_name();
      } else {
        setPktable_name((String)value);
      }
      break;

    case PKCOLUMN_NAME:
      if (value == null) {
        unsetPkcolumn_name();
      } else {
        setPkcolumn_name((String)value);
      }
      break;

    case FKTABLE_DB:
      if (value == null) {
        unsetFktable_db();
      } else {
        setFktable_db((String)value);
      }
      break;

    case FKTABLE_NAME:
      if (value == null) {
        unsetFktable_name();
      } else {
        setFktable_name((String)value);
      }
      break;

    case FKCOLUMN_NAME:
      if (value == null) {
        unsetFkcolumn_name();
      } else {
        setFkcolumn_name((String)value);
      }
      break;

    case KEY_SEQ:
      if (value == null) {
        unsetKey_seq();
      } else {
        setKey_seq((Integer)value);
      }
      break;

    case UPDATE_RULE:
      if (value == null) {
        unsetUpdate_rule();
      } else {
        setUpdate_rule((Integer)value);
      }
      break;

    case DELETE_RULE:
      if (value == null) {
        unsetDelete_rule();
      } else {
        setDelete_rule((Integer)value);
      }
      break;

    case FK_NAME:
      if (value == null) {
        unsetFk_name();
      } else {
        setFk_name((String)value);
      }
      break;

    case PK_NAME:
      if (value == null) {
        unsetPk_name();
      } else {
        setPk_name((String)value);
      }
      break;

    case ENABLE_CSTR:
      if (value == null) {
        unsetEnable_cstr();
      } else {
        setEnable_cstr((Boolean)value);
      }
      break;

    case VALIDATE_CSTR:
      if (value == null) {
        unsetValidate_cstr();
      } else {
        setValidate_cstr((Boolean)value);
      }
      break;

    case RELY_CSTR:
      if (value == null) {
        unsetRely_cstr();
      } else {
        setRely_cstr((Boolean)value);
      }
      break;

    case CAT_NAME:
      if (value == null) {
        unsetCatName();
      } else {
        setCatName((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case PKTABLE_DB:
      return getPktable_db();

    case PKTABLE_NAME:
      return getPktable_name();

    case PKCOLUMN_NAME:
      return getPkcolumn_name();

    case FKTABLE_DB:
      return getFktable_db();

    case FKTABLE_NAME:
      return getFktable_name();

    case FKCOLUMN_NAME:
      return getFkcolumn_name();

    case KEY_SEQ:
      return getKey_seq();

    case UPDATE_RULE:
      return getUpdate_rule();

    case DELETE_RULE:
      return getDelete_rule();

    case FK_NAME:
      return getFk_name();

    case PK_NAME:
      return getPk_name();

    case ENABLE_CSTR:
      return isEnable_cstr();

    case VALIDATE_CSTR:
      return isValidate_cstr();

    case RELY_CSTR:
      return isRely_cstr();

    case CAT_NAME:
      return getCatName();

    }
    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 PKTABLE_DB:
      return isSetPktable_db();
    case PKTABLE_NAME:
      return isSetPktable_name();
    case PKCOLUMN_NAME:
      return isSetPkcolumn_name();
    case FKTABLE_DB:
      return isSetFktable_db();
    case FKTABLE_NAME:
      return isSetFktable_name();
    case FKCOLUMN_NAME:
      return isSetFkcolumn_name();
    case KEY_SEQ:
      return isSetKey_seq();
    case UPDATE_RULE:
      return isSetUpdate_rule();
    case DELETE_RULE:
      return isSetDelete_rule();
    case FK_NAME:
      return isSetFk_name();
    case PK_NAME:
      return isSetPk_name();
    case ENABLE_CSTR:
      return isSetEnable_cstr();
    case VALIDATE_CSTR:
      return isSetValidate_cstr();
    case RELY_CSTR:
      return isSetRely_cstr();
    case CAT_NAME:
      return isSetCatName();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_pktable_db = true && this.isSetPktable_db();
    boolean that_present_pktable_db = true && that.isSetPktable_db();
    if (this_present_pktable_db || that_present_pktable_db) {
      if (!(this_present_pktable_db && that_present_pktable_db))
        return false;
      if (!this.pktable_db.equals(that.pktable_db))
        return false;
    }

    boolean this_present_pktable_name = true && this.isSetPktable_name();
    boolean that_present_pktable_name = true && that.isSetPktable_name();
    if (this_present_pktable_name || that_present_pktable_name) {
      if (!(this_present_pktable_name && that_present_pktable_name))
        return false;
      if (!this.pktable_name.equals(that.pktable_name))
        return false;
    }

    boolean this_present_pkcolumn_name = true && this.isSetPkcolumn_name();
    boolean that_present_pkcolumn_name = true && that.isSetPkcolumn_name();
    if (this_present_pkcolumn_name || that_present_pkcolumn_name) {
      if (!(this_present_pkcolumn_name && that_present_pkcolumn_name))
        return false;
      if (!this.pkcolumn_name.equals(that.pkcolumn_name))
        return false;
    }

    boolean this_present_fktable_db = true && this.isSetFktable_db();
    boolean that_present_fktable_db = true && that.isSetFktable_db();
    if (this_present_fktable_db || that_present_fktable_db) {
      if (!(this_present_fktable_db && that_present_fktable_db))
        return false;
      if (!this.fktable_db.equals(that.fktable_db))
        return false;
    }

    boolean this_present_fktable_name = true && this.isSetFktable_name();
    boolean that_present_fktable_name = true && that.isSetFktable_name();
    if (this_present_fktable_name || that_present_fktable_name) {
      if (!(this_present_fktable_name && that_present_fktable_name))
        return false;
      if (!this.fktable_name.equals(that.fktable_name))
        return false;
    }

    boolean this_present_fkcolumn_name = true && this.isSetFkcolumn_name();
    boolean that_present_fkcolumn_name = true && that.isSetFkcolumn_name();
    if (this_present_fkcolumn_name || that_present_fkcolumn_name) {
      if (!(this_present_fkcolumn_name && that_present_fkcolumn_name))
        return false;
      if (!this.fkcolumn_name.equals(that.fkcolumn_name))
        return false;
    }

    boolean this_present_key_seq = true;
    boolean that_present_key_seq = true;
    if (this_present_key_seq || that_present_key_seq) {
      if (!(this_present_key_seq && that_present_key_seq))
        return false;
      if (this.key_seq != that.key_seq)
        return false;
    }

    boolean this_present_update_rule = true;
    boolean that_present_update_rule = true;
    if (this_present_update_rule || that_present_update_rule) {
      if (!(this_present_update_rule && that_present_update_rule))
        return false;
      if (this.update_rule != that.update_rule)
        return false;
    }

    boolean this_present_delete_rule = true;
    boolean that_present_delete_rule = true;
    if (this_present_delete_rule || that_present_delete_rule) {
      if (!(this_present_delete_rule && that_present_delete_rule))
        return false;
      if (this.delete_rule != that.delete_rule)
        return false;
    }

    boolean this_present_fk_name = true && this.isSetFk_name();
    boolean that_present_fk_name = true && that.isSetFk_name();
    if (this_present_fk_name || that_present_fk_name) {
      if (!(this_present_fk_name && that_present_fk_name))
        return false;
      if (!this.fk_name.equals(that.fk_name))
        return false;
    }

    boolean this_present_pk_name = true && this.isSetPk_name();
    boolean that_present_pk_name = true && that.isSetPk_name();
    if (this_present_pk_name || that_present_pk_name) {
      if (!(this_present_pk_name && that_present_pk_name))
        return false;
      if (!this.pk_name.equals(that.pk_name))
        return false;
    }

    boolean this_present_enable_cstr = true;
    boolean that_present_enable_cstr = true;
    if (this_present_enable_cstr || that_present_enable_cstr) {
      if (!(this_present_enable_cstr && that_present_enable_cstr))
        return false;
      if (this.enable_cstr != that.enable_cstr)
        return false;
    }

    boolean this_present_validate_cstr = true;
    boolean that_present_validate_cstr = true;
    if (this_present_validate_cstr || that_present_validate_cstr) {
      if (!(this_present_validate_cstr && that_present_validate_cstr))
        return false;
      if (this.validate_cstr != that.validate_cstr)
        return false;
    }

    boolean this_present_rely_cstr = true;
    boolean that_present_rely_cstr = true;
    if (this_present_rely_cstr || that_present_rely_cstr) {
      if (!(this_present_rely_cstr && that_present_rely_cstr))
        return false;
      if (this.rely_cstr != that.rely_cstr)
        return false;
    }

    boolean this_present_catName = true && this.isSetCatName();
    boolean that_present_catName = true && that.isSetCatName();
    if (this_present_catName || that_present_catName) {
      if (!(this_present_catName && that_present_catName))
        return false;
      if (!this.catName.equals(that.catName))
        return false;
    }

    return true;
  }

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

    boolean present_pktable_db = true && (isSetPktable_db());
    list.add(present_pktable_db);
    if (present_pktable_db)
      list.add(pktable_db);

    boolean present_pktable_name = true && (isSetPktable_name());
    list.add(present_pktable_name);
    if (present_pktable_name)
      list.add(pktable_name);

    boolean present_pkcolumn_name = true && (isSetPkcolumn_name());
    list.add(present_pkcolumn_name);
    if (present_pkcolumn_name)
      list.add(pkcolumn_name);

    boolean present_fktable_db = true && (isSetFktable_db());
    list.add(present_fktable_db);
    if (present_fktable_db)
      list.add(fktable_db);

    boolean present_fktable_name = true && (isSetFktable_name());
    list.add(present_fktable_name);
    if (present_fktable_name)
      list.add(fktable_name);

    boolean present_fkcolumn_name = true && (isSetFkcolumn_name());
    list.add(present_fkcolumn_name);
    if (present_fkcolumn_name)
      list.add(fkcolumn_name);

    boolean present_key_seq = true;
    list.add(present_key_seq);
    if (present_key_seq)
      list.add(key_seq);

    boolean present_update_rule = true;
    list.add(present_update_rule);
    if (present_update_rule)
      list.add(update_rule);

    boolean present_delete_rule = true;
    list.add(present_delete_rule);
    if (present_delete_rule)
      list.add(delete_rule);

    boolean present_fk_name = true && (isSetFk_name());
    list.add(present_fk_name);
    if (present_fk_name)
      list.add(fk_name);

    boolean present_pk_name = true && (isSetPk_name());
    list.add(present_pk_name);
    if (present_pk_name)
      list.add(pk_name);

    boolean present_enable_cstr = true;
    list.add(present_enable_cstr);
    if (present_enable_cstr)
      list.add(enable_cstr);

    boolean present_validate_cstr = true;
    list.add(present_validate_cstr);
    if (present_validate_cstr)
      list.add(validate_cstr);

    boolean present_rely_cstr = true;
    list.add(present_rely_cstr);
    if (present_rely_cstr)
      list.add(rely_cstr);

    boolean present_catName = true && (isSetCatName());
    list.add(present_catName);
    if (present_catName)
      list.add(catName);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetPktable_db()).compareTo(other.isSetPktable_db());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPktable_db()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pktable_db, other.pktable_db);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPktable_name()).compareTo(other.isSetPktable_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPktable_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pktable_name, other.pktable_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPkcolumn_name()).compareTo(other.isSetPkcolumn_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPkcolumn_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pkcolumn_name, other.pkcolumn_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFktable_db()).compareTo(other.isSetFktable_db());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFktable_db()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fktable_db, other.fktable_db);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFktable_name()).compareTo(other.isSetFktable_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFktable_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fktable_name, other.fktable_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFkcolumn_name()).compareTo(other.isSetFkcolumn_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFkcolumn_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fkcolumn_name, other.fkcolumn_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetKey_seq()).compareTo(other.isSetKey_seq());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKey_seq()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.key_seq, other.key_seq);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUpdate_rule()).compareTo(other.isSetUpdate_rule());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdate_rule()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.update_rule, other.update_rule);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDelete_rule()).compareTo(other.isSetDelete_rule());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDelete_rule()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.delete_rule, other.delete_rule);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetFk_name()).compareTo(other.isSetFk_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFk_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fk_name, other.fk_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPk_name()).compareTo(other.isSetPk_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPk_name()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pk_name, other.pk_name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEnable_cstr()).compareTo(other.isSetEnable_cstr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEnable_cstr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enable_cstr, other.enable_cstr);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetValidate_cstr()).compareTo(other.isSetValidate_cstr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetValidate_cstr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.validate_cstr, other.validate_cstr);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRely_cstr()).compareTo(other.isSetRely_cstr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRely_cstr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rely_cstr, other.rely_cstr);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCatName()).compareTo(other.isSetCatName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCatName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catName, other.catName);
      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("SQLForeignKey(");
    boolean first = true;

    sb.append("pktable_db:");
    if (this.pktable_db == null) {
      sb.append("null");
    } else {
      sb.append(this.pktable_db);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pktable_name:");
    if (this.pktable_name == null) {
      sb.append("null");
    } else {
      sb.append(this.pktable_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pkcolumn_name:");
    if (this.pkcolumn_name == null) {
      sb.append("null");
    } else {
      sb.append(this.pkcolumn_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("fktable_db:");
    if (this.fktable_db == null) {
      sb.append("null");
    } else {
      sb.append(this.fktable_db);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("fktable_name:");
    if (this.fktable_name == null) {
      sb.append("null");
    } else {
      sb.append(this.fktable_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("fkcolumn_name:");
    if (this.fkcolumn_name == null) {
      sb.append("null");
    } else {
      sb.append(this.fkcolumn_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("key_seq:");
    sb.append(this.key_seq);
    first = false;
    if (!first) sb.append(", ");
    sb.append("update_rule:");
    sb.append(this.update_rule);
    first = false;
    if (!first) sb.append(", ");
    sb.append("delete_rule:");
    sb.append(this.delete_rule);
    first = false;
    if (!first) sb.append(", ");
    sb.append("fk_name:");
    if (this.fk_name == null) {
      sb.append("null");
    } else {
      sb.append(this.fk_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("pk_name:");
    if (this.pk_name == null) {
      sb.append("null");
    } else {
      sb.append(this.pk_name);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("enable_cstr:");
    sb.append(this.enable_cstr);
    first = false;
    if (!first) sb.append(", ");
    sb.append("validate_cstr:");
    sb.append(this.validate_cstr);
    first = false;
    if (!first) sb.append(", ");
    sb.append("rely_cstr:");
    sb.append(this.rely_cstr);
    first = false;
    if (isSetCatName()) {
      if (!first) sb.append(", ");
      sb.append("catName:");
      if (this.catName == null) {
        sb.append("null");
      } else {
        sb.append(this.catName);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  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 SQLForeignKeyStandardSchemeFactory implements SchemeFactory {
    public SQLForeignKeyStandardScheme getScheme() {
      return new SQLForeignKeyStandardScheme();
    }
  }

  private static class SQLForeignKeyStandardScheme extends StandardScheme<SQLForeignKey> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SQLForeignKey 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: // PKTABLE_DB
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pktable_db = iprot.readString();
              struct.setPktable_dbIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PKTABLE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pktable_name = iprot.readString();
              struct.setPktable_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // PKCOLUMN_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pkcolumn_name = iprot.readString();
              struct.setPkcolumn_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // FKTABLE_DB
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fktable_db = iprot.readString();
              struct.setFktable_dbIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // FKTABLE_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fktable_name = iprot.readString();
              struct.setFktable_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // FKCOLUMN_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fkcolumn_name = iprot.readString();
              struct.setFkcolumn_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // KEY_SEQ
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.key_seq = iprot.readI32();
              struct.setKey_seqIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // UPDATE_RULE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.update_rule = iprot.readI32();
              struct.setUpdate_ruleIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // DELETE_RULE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.delete_rule = iprot.readI32();
              struct.setDelete_ruleIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // FK_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.fk_name = iprot.readString();
              struct.setFk_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // PK_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pk_name = iprot.readString();
              struct.setPk_nameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // ENABLE_CSTR
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.enable_cstr = iprot.readBool();
              struct.setEnable_cstrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // VALIDATE_CSTR
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.validate_cstr = iprot.readBool();
              struct.setValidate_cstrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // RELY_CSTR
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.rely_cstr = iprot.readBool();
              struct.setRely_cstrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // CAT_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.catName = iprot.readString();
              struct.setCatNameIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.pktable_db != null) {
        oprot.writeFieldBegin(PKTABLE_DB_FIELD_DESC);
        oprot.writeString(struct.pktable_db);
        oprot.writeFieldEnd();
      }
      if (struct.pktable_name != null) {
        oprot.writeFieldBegin(PKTABLE_NAME_FIELD_DESC);
        oprot.writeString(struct.pktable_name);
        oprot.writeFieldEnd();
      }
      if (struct.pkcolumn_name != null) {
        oprot.writeFieldBegin(PKCOLUMN_NAME_FIELD_DESC);
        oprot.writeString(struct.pkcolumn_name);
        oprot.writeFieldEnd();
      }
      if (struct.fktable_db != null) {
        oprot.writeFieldBegin(FKTABLE_DB_FIELD_DESC);
        oprot.writeString(struct.fktable_db);
        oprot.writeFieldEnd();
      }
      if (struct.fktable_name != null) {
        oprot.writeFieldBegin(FKTABLE_NAME_FIELD_DESC);
        oprot.writeString(struct.fktable_name);
        oprot.writeFieldEnd();
      }
      if (struct.fkcolumn_name != null) {
        oprot.writeFieldBegin(FKCOLUMN_NAME_FIELD_DESC);
        oprot.writeString(struct.fkcolumn_name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(KEY_SEQ_FIELD_DESC);
      oprot.writeI32(struct.key_seq);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(UPDATE_RULE_FIELD_DESC);
      oprot.writeI32(struct.update_rule);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(DELETE_RULE_FIELD_DESC);
      oprot.writeI32(struct.delete_rule);
      oprot.writeFieldEnd();
      if (struct.fk_name != null) {
        oprot.writeFieldBegin(FK_NAME_FIELD_DESC);
        oprot.writeString(struct.fk_name);
        oprot.writeFieldEnd();
      }
      if (struct.pk_name != null) {
        oprot.writeFieldBegin(PK_NAME_FIELD_DESC);
        oprot.writeString(struct.pk_name);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(ENABLE_CSTR_FIELD_DESC);
      oprot.writeBool(struct.enable_cstr);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(VALIDATE_CSTR_FIELD_DESC);
      oprot.writeBool(struct.validate_cstr);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(RELY_CSTR_FIELD_DESC);
      oprot.writeBool(struct.rely_cstr);
      oprot.writeFieldEnd();
      if (struct.catName != null) {
        if (struct.isSetCatName()) {
          oprot.writeFieldBegin(CAT_NAME_FIELD_DESC);
          oprot.writeString(struct.catName);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SQLForeignKeyTupleSchemeFactory implements SchemeFactory {
    public SQLForeignKeyTupleScheme getScheme() {
      return new SQLForeignKeyTupleScheme();
    }
  }

  private static class SQLForeignKeyTupleScheme extends TupleScheme<SQLForeignKey> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SQLForeignKey struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetPktable_db()) {
        optionals.set(0);
      }
      if (struct.isSetPktable_name()) {
        optionals.set(1);
      }
      if (struct.isSetPkcolumn_name()) {
        optionals.set(2);
      }
      if (struct.isSetFktable_db()) {
        optionals.set(3);
      }
      if (struct.isSetFktable_name()) {
        optionals.set(4);
      }
      if (struct.isSetFkcolumn_name()) {
        optionals.set(5);
      }
      if (struct.isSetKey_seq()) {
        optionals.set(6);
      }
      if (struct.isSetUpdate_rule()) {
        optionals.set(7);
      }
      if (struct.isSetDelete_rule()) {
        optionals.set(8);
      }
      if (struct.isSetFk_name()) {
        optionals.set(9);
      }
      if (struct.isSetPk_name()) {
        optionals.set(10);
      }
      if (struct.isSetEnable_cstr()) {
        optionals.set(11);
      }
      if (struct.isSetValidate_cstr()) {
        optionals.set(12);
      }
      if (struct.isSetRely_cstr()) {
        optionals.set(13);
      }
      if (struct.isSetCatName()) {
        optionals.set(14);
      }
      oprot.writeBitSet(optionals, 15);
      if (struct.isSetPktable_db()) {
        oprot.writeString(struct.pktable_db);
      }
      if (struct.isSetPktable_name()) {
        oprot.writeString(struct.pktable_name);
      }
      if (struct.isSetPkcolumn_name()) {
        oprot.writeString(struct.pkcolumn_name);
      }
      if (struct.isSetFktable_db()) {
        oprot.writeString(struct.fktable_db);
      }
      if (struct.isSetFktable_name()) {
        oprot.writeString(struct.fktable_name);
      }
      if (struct.isSetFkcolumn_name()) {
        oprot.writeString(struct.fkcolumn_name);
      }
      if (struct.isSetKey_seq()) {
        oprot.writeI32(struct.key_seq);
      }
      if (struct.isSetUpdate_rule()) {
        oprot.writeI32(struct.update_rule);
      }
      if (struct.isSetDelete_rule()) {
        oprot.writeI32(struct.delete_rule);
      }
      if (struct.isSetFk_name()) {
        oprot.writeString(struct.fk_name);
      }
      if (struct.isSetPk_name()) {
        oprot.writeString(struct.pk_name);
      }
      if (struct.isSetEnable_cstr()) {
        oprot.writeBool(struct.enable_cstr);
      }
      if (struct.isSetValidate_cstr()) {
        oprot.writeBool(struct.validate_cstr);
      }
      if (struct.isSetRely_cstr()) {
        oprot.writeBool(struct.rely_cstr);
      }
      if (struct.isSetCatName()) {
        oprot.writeString(struct.catName);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SQLForeignKey struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(15);
      if (incoming.get(0)) {
        struct.pktable_db = iprot.readString();
        struct.setPktable_dbIsSet(true);
      }
      if (incoming.get(1)) {
        struct.pktable_name = iprot.readString();
        struct.setPktable_nameIsSet(true);
      }
      if (incoming.get(2)) {
        struct.pkcolumn_name = iprot.readString();
        struct.setPkcolumn_nameIsSet(true);
      }
      if (incoming.get(3)) {
        struct.fktable_db = iprot.readString();
        struct.setFktable_dbIsSet(true);
      }
      if (incoming.get(4)) {
        struct.fktable_name = iprot.readString();
        struct.setFktable_nameIsSet(true);
      }
      if (incoming.get(5)) {
        struct.fkcolumn_name = iprot.readString();
        struct.setFkcolumn_nameIsSet(true);
      }
      if (incoming.get(6)) {
        struct.key_seq = iprot.readI32();
        struct.setKey_seqIsSet(true);
      }
      if (incoming.get(7)) {
        struct.update_rule = iprot.readI32();
        struct.setUpdate_ruleIsSet(true);
      }
      if (incoming.get(8)) {
        struct.delete_rule = iprot.readI32();
        struct.setDelete_ruleIsSet(true);
      }
      if (incoming.get(9)) {
        struct.fk_name = iprot.readString();
        struct.setFk_nameIsSet(true);
      }
      if (incoming.get(10)) {
        struct.pk_name = iprot.readString();
        struct.setPk_nameIsSet(true);
      }
      if (incoming.get(11)) {
        struct.enable_cstr = iprot.readBool();
        struct.setEnable_cstrIsSet(true);
      }
      if (incoming.get(12)) {
        struct.validate_cstr = iprot.readBool();
        struct.setValidate_cstrIsSet(true);
      }
      if (incoming.get(13)) {
        struct.rely_cstr = iprot.readBool();
        struct.setRely_cstrIsSet(true);
      }
      if (incoming.get(14)) {
        struct.catName = iprot.readString();
        struct.setCatNameIsSet(true);
      }
    }
  }

}

