//struct MetaPageFrequency //{ // public int Offset; // public double Frequency; //} /// <summary> /// Saves the database schema /// </summary> /// <param name="writer">binary writer</param> public void Save(io.BinaryWriter writer) { //flags writer.Write((UInt32)Flags); // Version.BinarySave(writer); Description.BinarySave(writer); Name.BinarySave(writer); //page size writer.Write(PageSize); //tables int pageCount = _tables.Count; // Tables.Count; writer.Write(pageCount); //frequency //var frequencyList = new List<KeyValuePair<string, List<MetaPageFrequency>>>(); foreach (var table in _tables.Select(t => t.Value)) // Tables { table.Name.BinarySave(writer); table.FileName.BinarySave(writer); writer.Write(table.Generate); writer.Write(table.Multikey); // writer.Write(table.Rows); writer.Write(table.RowMask); writer.Write(table.RowMaskLength); //pager table.Pager.Store(writer); //columns writer.Write(table.Count); foreach (var column in table.Columns) { column.Indexer.BinarySave(writer); writer.Write(column.Unique); column.Name.BinarySave(writer); writer.Write(column.Index); column.Type.BinarySave(writer); writer.Write(column.Key); writer.Write(column.Indexed); // writer.Write(column.NodePages); writer.Write(column.ItemPages); //frequency //var hash = $"{table.Name}.{column.Name}"; //var freq = new KeyValuePair<string, List<MetaPageFrequency>>(hash, new List<MetaPageFrequency>()); //frequencyList.Add(freq); } } //save frequency data to disk }