/// <summary> /// creates an option entry with specified name(s) and descriptoin /// </summary> /// <param name="section">the section that contains this new entry</param> /// <param name="s">the name of the entry</param> /// <param name="description">the descriptiion of the entry.</param> internal OptionEntry(OptionMap section, string s, string description) { OptionMapDataset4 ds = section.ds; object name_id = ds.name.GetNameID(section.db, s); // section.names[s]; object ID; if (section.root.option_map_key_type == typeof(Guid)) { DataRow row = ds.CreateOption(section.db, ID = DsnConnection.GetGUID(section.db), section.ID, name_id); if (description != null) { row["description"] = description; } } else { DataRow row = ds.CreateOption(section.db, section.ID, name_id); ID = row[ds.map.option_idColumn]; if (description != null) { row["description"] = description; } } sub_options = new OptionMap(this, ID); this.section = section; m_name = s; }
internal OptionEntry(OptionMap section, string s) { OptionMapDataset4 ds = section.ds; object name_id = ds.name.GetNameID(section.db, s); // section.names[s]; object ID; if (section.root.option_map_key_type == typeof(Guid)) { ds.CreateOption(section.db, ID = DsnConnection.GetGUID(section.db), section.ID, name_id); } else { ID = ds.CreateOption(section.db, section.ID, name_id); } sub_options = new OptionMap(this, ID); this.section = section; m_name = s; return; #if asdfasdf object name_id = section.names[s]; object option_id; if (!section.fallback_ini) { option_id = section.db.KindExecuteInsert("insert into " + OptionMap.Prefix + "map(parent_option_id,name_id) values('" + section.ID + "','" + name_id + "')"); } else { option_id = 1; } this.section = section; sub_options = new OptionMap(this, option_id); m_name = s; #endif }
public object GetNameID(DsnConnection dsn, String name) { DataRow[] row = Select(nameColumn.ColumnName + "='" + name + "'"); if (row.Length == 0) { OptionMapDataset4 ds = this.DataSet as OptionMapDataset4; DataRow newname = NewRow(); newname[name_idColumn] = DsnConnection.GetGUID(dsn); newname[nameColumn] = name; Rows.Add(newname); ds.ScheduleCommit(dsn, this); return(newname[name_idColumn]); } return(row[0][name_idColumn]); }