public bool columnIsPrimary(string fieldName) { MysqlKeySet tmp = getKeyByFieldName(fieldName); if (null == tmp) { return(false); } else { return(tmp.keyName == "PRIMARY"); } }
public bool columnIsUnique(string fieldName) { MysqlKeySet tmp = getKeyByFieldName(fieldName); if (null == tmp) { return(false); } else { return(!tmp.nonUnique); } }
private void assignValues(List <Hashtable> res) { keySet.Clear(); PrimaryKeySet.Clear(); for (int i = 0; i < res.Count; i++) { MysqlKeySet set = new MysqlKeySet(); set.nonUnique = res[i]["Non_unique"].ToString() != "0"; set.keyName = res[i]["Key_name"].ToString(); set.columnName = res[i]["Column_name"].ToString(); set.indexType = res[i]["Index_type"].ToString(); set.seqInSequence = int.Parse(res[i]["Seq_in_index"].ToString()); if (res[i]["Collation"] != null) { set.collation = res[i]["Collation"].ToString(); } if (res[i]["Cardinality"] != null) { set.cardinality = int.Parse(res[i]["Cardinality"].ToString()); } if (res[i]["Sub_part"] != null) { set.subPart = int.Parse(res[i]["Sub_part"].ToString()); } if (res[i]["Packed"] != null) { set.isPacked = true; } else { set.isPacked = false; } if (res[i]["Null"] != null && "YES" == res[i]["Null"].ToString()) { set.nullPossible = true; } else { set.nullPossible = false; } keySet.Add(set); if (set.keyName == "PRIMARY") { PrimaryKeySet.Add(set); } } }