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

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)")
@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 org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SQLForeignKeyStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new SQLForeignKeyTupleSchemeFactory();

  private @org.apache.thrift.annotation.Nullable java.lang.String pktable_db; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String pktable_name; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String pkcolumn_name; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String fktable_db; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String fktable_name; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String fkcolumn_name; // required
  private int key_seq; // required
  private int update_rule; // required
  private int delete_rule; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String fk_name; // required
  private @org.apache.thrift.annotation.Nullable java.lang.String pk_name; // required
  private boolean enable_cstr; // required
  private boolean validate_cstr; // required
  private boolean rely_cstr; // required
  private @org.apache.thrift.annotation.Nullable java.lang.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 java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.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 java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.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 = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SQLForeignKey.class, metaDataMap);
  }

  public SQLForeignKey() {
  }

  public SQLForeignKey(
    java.lang.String pktable_db,
    java.lang.String pktable_name,
    java.lang.String pkcolumn_name,
    java.lang.String fktable_db,
    java.lang.String fktable_name,
    java.lang.String fkcolumn_name,
    int key_seq,
    int update_rule,
    int delete_rule,
    java.lang.String fk_name,
    java.lang.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;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getPktable_db() {
    return this.pktable_db;
  }

  public void setPktable_db(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getPktable_name() {
    return this.pktable_name;
  }

  public void setPktable_name(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getPkcolumn_name() {
    return this.pkcolumn_name;
  }

  public void setPkcolumn_name(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFktable_db() {
    return this.fktable_db;
  }

  public void setFktable_db(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFktable_name() {
    return this.fktable_name;
  }

  public void setFktable_name(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFkcolumn_name() {
    return this.fkcolumn_name;
  }

  public void setFkcolumn_name(@org.apache.thrift.annotation.Nullable java.lang.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __KEY_SEQ_ISSET_ID);
  }

  public void setKey_seqIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __UPDATE_RULE_ISSET_ID);
  }

  public void setUpdate_ruleIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __DELETE_RULE_ISSET_ID);
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getFk_name() {
    return this.fk_name;
  }

  public void setFk_name(@org.apache.thrift.annotation.Nullable java.lang.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;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getPk_name() {
    return this.pk_name;
  }

  public void setPk_name(@org.apache.thrift.annotation.Nullable java.lang.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENABLE_CSTR_ISSET_ID);
  }

  public void setEnable_cstrIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __VALIDATE_CSTR_ISSET_ID);
  }

  public void setValidate_cstrIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.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 = org.apache.thrift.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 org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __RELY_CSTR_ISSET_ID);
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getCatName() {
    return this.catName;
  }

  public void setCatName(@org.apache.thrift.annotation.Nullable java.lang.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, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case PKTABLE_DB:
      if (value == null) {
        unsetPktable_db();
      } else {
        setPktable_db((java.lang.String)value);
      }
      break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.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 java.lang.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 java.lang.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 java.lang.IllegalStateException();
  }

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

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

    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() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetPktable_db()) ? 131071 : 524287);
    if (isSetPktable_db())
      hashCode = hashCode * 8191 + pktable_db.hashCode();

    hashCode = hashCode * 8191 + ((isSetPktable_name()) ? 131071 : 524287);
    if (isSetPktable_name())
      hashCode = hashCode * 8191 + pktable_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetPkcolumn_name()) ? 131071 : 524287);
    if (isSetPkcolumn_name())
      hashCode = hashCode * 8191 + pkcolumn_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetFktable_db()) ? 131071 : 524287);
    if (isSetFktable_db())
      hashCode = hashCode * 8191 + fktable_db.hashCode();

    hashCode = hashCode * 8191 + ((isSetFktable_name()) ? 131071 : 524287);
    if (isSetFktable_name())
      hashCode = hashCode * 8191 + fktable_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetFkcolumn_name()) ? 131071 : 524287);
    if (isSetFkcolumn_name())
      hashCode = hashCode * 8191 + fkcolumn_name.hashCode();

    hashCode = hashCode * 8191 + key_seq;

    hashCode = hashCode * 8191 + update_rule;

    hashCode = hashCode * 8191 + delete_rule;

    hashCode = hashCode * 8191 + ((isSetFk_name()) ? 131071 : 524287);
    if (isSetFk_name())
      hashCode = hashCode * 8191 + fk_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetPk_name()) ? 131071 : 524287);
    if (isSetPk_name())
      hashCode = hashCode * 8191 + pk_name.hashCode();

    hashCode = hashCode * 8191 + ((enable_cstr) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((validate_cstr) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((rely_cstr) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetCatName()) ? 131071 : 524287);
    if (isSetCatName())
      hashCode = hashCode * 8191 + catName.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetPktable_db(), 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 = java.lang.Boolean.compare(isSetPktable_name(), 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 = java.lang.Boolean.compare(isSetPkcolumn_name(), 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 = java.lang.Boolean.compare(isSetFktable_db(), 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 = java.lang.Boolean.compare(isSetFktable_name(), 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 = java.lang.Boolean.compare(isSetFkcolumn_name(), 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 = java.lang.Boolean.compare(isSetKey_seq(), 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 = java.lang.Boolean.compare(isSetUpdate_rule(), 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 = java.lang.Boolean.compare(isSetDelete_rule(), 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 = java.lang.Boolean.compare(isSetFk_name(), 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 = java.lang.Boolean.compare(isSetPk_name(), 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 = java.lang.Boolean.compare(isSetEnable_cstr(), 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 = java.lang.Boolean.compare(isSetValidate_cstr(), 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 = java.lang.Boolean.compare(isSetRely_cstr(), 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 = java.lang.Boolean.compare(isSetCatName(), 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;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

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

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

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.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, java.lang.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 org.apache.thrift.scheme.SchemeFactory {
    public SQLForeignKeyStandardScheme getScheme() {
      return new SQLForeignKeyStandardScheme();
    }
  }

  private static class SQLForeignKeyStandardScheme extends org.apache.thrift.scheme.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 org.apache.thrift.scheme.SchemeFactory {
    public SQLForeignKeyTupleScheme getScheme() {
      return new SQLForeignKeyTupleScheme();
    }
  }

  private static class SQLForeignKeyTupleScheme extends org.apache.thrift.scheme.TupleScheme<SQLForeignKey> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SQLForeignKey struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.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 {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.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);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

