protected RelOptions ParseRelOptions(object value) { var result = new RelOptions(); var options = value as string[]; if (options == null) { return(result); } for (int i = 0; i < options.Length; i++) { options[i] = options[i].Trim(); string optionName; string optionValue = ""; int pos = options[i].IndexOf('='); if (pos >= 0) { optionName = options[i].Substring(0, pos).ToLower(); optionValue = options[i].Substring(pos + 1); } else { optionName = options[i]; } ReadRelOption(optionName, optionValue, result); } return(result); }
protected override void ReadSpecialIndexProperties(DbDataReader dr, Index i) { base.ReadSpecialIndexProperties(dr, i); if (dr["reloptions"] != DBNull.Value) { RelOptions ro = ParseRelOptions(dr["reloptions"]); i.FillFactor = ro.FillFactor; } }
/// <summary> /// Reads a certain reloption value. /// </summary> /// <param name="optionName">The name of the option in lowercase</param> /// <param name="optionValue">The value of the option, maybe empty, but not null</param> /// <returns></returns> protected virtual void ReadRelOption(string optionName, string optionValue, RelOptions options) { if (optionName == "fillfactor") { _ = byte.TryParse(optionValue, out var value); if (value > 0) { options.FillFactor = value; } } }